public class Execed extends Object
Modifier and Type | Field | Description |
---|---|---|
protected List<String> |
cmd |
|
protected boolean |
combinedOutput |
|
protected int |
exitCode |
|
protected boolean |
finished |
|
protected Process |
process |
Modifier | Constructor | Description |
---|---|---|
protected |
Execed(List<String> cmd,
Process p,
boolean combinedOutput) |
Modifier and Type | Method | Description |
---|---|---|
protected Thread |
copy(InputStream in,
Writer out) |
|
protected Thread |
discard(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) |
|
Process |
getProcess() |
|
String |
getStandardError() |
|
InputStream |
getStandardErrorStream() |
|
OutputStream |
getStandardInputStream() |
|
String |
getStandardOut() |
|
InputStream |
getStandardOutputStream() |
|
boolean |
isFinished() |
Determines if the application has completed yet
|
protected boolean |
isStillReadingOutput() |
Returns true if the output of this process is still being read
|
void |
kill() |
|
void |
kill(boolean force) |
|
static Execed |
spawn(Exec e) |
|
protected void |
unexpectedFailure(IOException e) |
|
int |
waitForExit() |
Wait an indefinite amount of time for the process to exit
|
int |
waitForExit(int expected) |
Wait an indefinite amount of time for the process to exit, expecting the return code to be
expected . |
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 . |
protected final Process process
protected final boolean combinedOutput
protected boolean finished
protected int exitCode
public static Execed spawn(Exec e) throws IOException
IOException
public String getStandardOut()
public String getStandardError()
public boolean isFinished()
protected boolean isStillReadingOutput()
public void discardOutput()
public Process getProcess()
public final void kill()
public void kill(boolean force)
public int exitCode() throws IllegalThreadStateException
IllegalStateException
- if the process has not yet terminatedIllegalThreadStateException
public int waitForExit(int expected)
expected
. If the
output is not expected
then a RuntimeException is thrownexpected
- the expected return codeRuntimeException
- 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
- 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 InputStream getStandardOutputStream()
public InputStream getStandardErrorStream()
public OutputStream getStandardInputStream()
protected void finished(int exitCode)
protected void unexpectedFailure(IOException e)
protected Thread copy(InputStream in, Writer out)
protected Thread discard(InputStream in)
Copyright © 2018. All rights reserved.