public class BaseExeced
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.lang.String> |
cmd |
protected boolean |
combinedOutput |
protected int |
exitCode |
protected boolean |
finished |
java.lang.Object |
monitor |
protected java.lang.Process |
process |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseExeced(java.util.List<java.lang.String> cmd,
java.lang.Process p,
boolean combinedOutput) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Thread |
copy(java.io.InputStream in,
java.io.Writer out) |
protected java.lang.Thread |
discard(java.io.InputStream in) |
void |
discardOutput()
Indicates that the output of this process should be discarded
|
int |
exitCode()
Returns the exit code of the application, assuming it has already terminated.
|
protected void |
finished(int exitCode) |
java.io.InputStream |
getStandardErrorStream() |
java.io.OutputStream |
getStandardInputStream() |
java.io.InputStream |
getStandardOutputStream() |
boolean |
isFinished()
Determines if the application has completed yet
|
void |
kill() |
static BaseExeced |
spawn(Exec e) |
protected void |
unexpectedFailure(java.io.IOException e) |
int |
waitForExit()
Wait an indefinite amount of time for the process to exit
|
int |
waitForExit(Deadline deadline)
Waits for the process to exit; this method blocks until the process has completed (at which point it returns the process
exit code) or until
deadline has elapsed, at which point it returns Integer.MIN_VALUE |
int |
waitForExit(Deadline deadline,
int expected)
Wait until
deadline for the process to exit, expecting the return code to be expected. |
int |
waitForExit(int expected)
Wait an indefinite amount of time for the process to exit, expecting the return code to be
expected. |
public final java.lang.Object monitor
protected final java.util.List<java.lang.String> cmd
protected final java.lang.Process process
protected final boolean combinedOutput
protected boolean finished
protected int exitCode
protected BaseExeced(java.util.List<java.lang.String> cmd,
java.lang.Process p,
boolean combinedOutput)
public void kill()
public boolean isFinished()
public int exitCode()
throws java.lang.IllegalThreadStateException
java.lang.IllegalStateException - if the process has not yet terminatedjava.lang.IllegalThreadStateExceptionpublic int waitForExit(int expected)
expected. If the
output is not expected then a RuntimeException is thrownexpected - the expected return codejava.lang.RuntimeException - if the return code was not what was expectedpublic int waitForExit(Deadline deadline, int expected)
deadline for the process to exit, expecting the return code to be expected. If the
output is not expected (or if the operation times out) then a RuntimeException is throwndeadline - expected - java.lang.RuntimeException - if a timeout occurrs or if the return code was not what was expectedpublic int waitForExit()
public int waitForExit(Deadline deadline)
deadline has elapsed, at which point it returns Integer.MIN_VALUEdeadline - public java.io.InputStream getStandardOutputStream()
public java.io.InputStream getStandardErrorStream()
public java.io.OutputStream getStandardInputStream()
public void discardOutput()
protected void finished(int exitCode)
protected void unexpectedFailure(java.io.IOException e)
protected java.lang.Thread copy(java.io.InputStream in,
java.io.Writer out)
protected java.lang.Thread discard(java.io.InputStream in)
public static BaseExeced spawn(Exec e) throws java.io.IOException
java.io.IOExceptionCopyright © 2014. All Rights Reserved.