Module io.smallrye.common.process
Package io.smallrye.common.process
Interface WaitableProcessHandle
- All Superinterfaces:
Comparable<ProcessHandle>,ProcessHandle
A process handle that can be waited for and whose exit value may be read.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.lang.ProcessHandle
ProcessHandle.Info -
Method Summary
Modifier and TypeMethodDescriptionReturns the initial process arguments as an immutable list (notnull).command()Returns the initial process command (notnull).intReturns the process exit value.intwaitFor()Wait indefinitely for the process to exit.booleanWait for the process to exit for up to the given time.default intWait indefinitely and uninterruptibly for the process to exit.default booleanwaitUninterruptiblyFor(long timeout, TimeUnit unit) Wait uninterruptibly for the process to exit for up to the given time.Methods inherited from interface java.lang.ProcessHandle
children, compareTo, descendants, destroy, destroyForcibly, equals, hashCode, info, isAlive, onExit, parent, pid, supportsNormalTermination
-
Method Details
-
command
Path command()Returns the initial process command (notnull). This may differ from whatProcessHandle.Info.command()returns.- Returns:
- the initial process command (not
null)
-
arguments
Returns the initial process arguments as an immutable list (notnull). This may differ from whatProcessHandle.Info.arguments()returns.- Returns:
- the initial process arguments as an immutable list (not
null)
-
waitFor
Wait indefinitely for the process to exit.- Returns:
- the exit code of the process
- Throws:
InterruptedException- if the current thread is interrupted- See Also:
-
waitUninterruptiblyFor
default int waitUninterruptiblyFor()Wait indefinitely and uninterruptibly for the process to exit.- Returns:
- the exit code of the process
- See Also:
-
waitFor
Wait for the process to exit for up to the given time.- Parameters:
timeout- the amount of time to waitunit- the time unit (must not benull)- Returns:
trueif the process has exited, orfalseif it is still running- Throws:
InterruptedException- if the current thread is interrupted- See Also:
-
waitUninterruptiblyFor
Wait uninterruptibly for the process to exit for up to the given time.- Parameters:
timeout- the amount of time to waitunit- the time unit (must not benull)- Returns:
trueif the process has exited, orfalseif it is still running- See Also:
-
exitValue
int exitValue()Returns the process exit value.- Returns:
- the process exit value
- Throws:
IllegalThreadStateException- if the process has not exited- See Also:
-