Package com.arakelian.core.utils
Class ProcessUtils.ProcessInfo<O extends java.util.function.Consumer<java.lang.String>,E extends java.util.function.Consumer<java.lang.String>>
- java.lang.Object
-
- com.arakelian.core.utils.ProcessUtils.ProcessInfo<O,E>
-
- Enclosing class:
- ProcessUtils
public static class ProcessUtils.ProcessInfo<O extends java.util.function.Consumer<java.lang.String>,E extends java.util.function.Consumer<java.lang.String>> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ProcessInfo(java.lang.ProcessBuilder builder, O stdout, E stderr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidensureDestroyed()voidensureDestroyed(long timeout, java.util.concurrent.TimeUnit unit)java.lang.StringgetCommandLine()intgetExitCode()intgetExitCodeQuietly(int defaultValue)EgetStderr()OgetStdout()booleanisAlive()java.lang.StringtoString()ProcessUtils.ProcessInfo<O,E>waitFor()booleanwaitFor(long timeout, java.util.concurrent.TimeUnit unit)Causes the current thread to wait, if necessary, until the subprocess represented by thisProcessInfoobject has terminated, or the specified waiting time elapses.
-
-
-
Method Detail
-
ensureDestroyed
public final void ensureDestroyed()
-
ensureDestroyed
public final void ensureDestroyed(long timeout, java.util.concurrent.TimeUnit unit)
-
getCommandLine
public java.lang.String getCommandLine()
-
getExitCode
public final int getExitCode() throws java.lang.IllegalThreadStateException- Throws:
java.lang.IllegalThreadStateException
-
getExitCodeQuietly
public final int getExitCodeQuietly(int defaultValue)
-
getStderr
public E getStderr()
-
getStdout
public O getStdout()
-
isAlive
public final boolean isAlive()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
waitFor
public final ProcessUtils.ProcessInfo<O,E> waitFor() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
waitFor
public final boolean waitFor(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedExceptionCauses the current thread to wait, if necessary, until the subprocess represented by thisProcessInfoobject has terminated, or the specified waiting time elapses. If the subprocess has already terminated then this method returns immediately with the valuetrue. If the process has not terminated and the timeout value is less than, or equal to, zero, then this method returns immediately with the valuefalse.- Parameters:
timeout- the maximum time to waitunit- the time unit of thetimeoutargument- Returns:
trueif the subprocess has exited andfalseif the waiting time elapsed before the subprocess has exited.- Throws:
java.lang.InterruptedException- if the current thread is interrupted while waiting.java.lang.NullPointerException- if unit is null
-
-