public abstract class Launcher extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
Launcher.Drainer
A thread that runs in a loop, performing the drain() action until a process terminates
|
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
env |
protected byte[] |
stdErr |
protected byte[] |
stdOut |
protected File |
workingDir |
Modifier | Constructor and Description |
---|---|
protected |
Launcher(boolean captureOutput,
boolean captureErr,
Logger logger) |
protected |
Launcher(Logger logger) |
Modifier and Type | Method and Description |
---|---|
protected Launcher.Drainer |
captureStdErr(Process p) |
protected Launcher.Drainer |
captureStdOut(Process p) |
protected Thread |
drainStdErr(Process p) |
protected Thread |
drainStdOut(Process p) |
Map<String,String> |
getEnv() |
byte[] |
getInput() |
byte[] |
getStderr() |
byte[] |
getStdOut() |
File |
getWorkingDir() |
boolean |
isCaptureErr() |
boolean |
isCaptureOutput() |
void |
setEnv(Map<String,String> newEnv) |
void |
setInput(byte[] input)
Set input which will be fed to the launched process's stdin
|
protected void |
setStdErr(byte[] newErr) |
protected void |
setStdOut(byte[] newOutput) |
void |
setWorkingDir(File newWorkingDir) |
protected Process |
spawnProcess(String cmd)
Spawn a process to execute the given command
|
protected Process |
spawnProcess(String[] cmd)
Spawn a process to execute the given command
|
String |
toString() |
protected File workingDir
protected byte[] stdOut
protected byte[] stdErr
protected Launcher(Logger logger)
protected Launcher(boolean captureOutput, boolean captureErr, Logger logger)
public File getWorkingDir()
public void setWorkingDir(File newWorkingDir)
protected Process spawnProcess(String cmd) throws IllegalArgumentException, IOException
IllegalArgumentException
IOException
protected Process spawnProcess(String[] cmd) throws IllegalArgumentException, IOException
IllegalArgumentException
IOException
protected Launcher.Drainer captureStdOut(Process p)
protected Launcher.Drainer captureStdErr(Process p)
public boolean isCaptureOutput()
public boolean isCaptureErr()
public byte[] getStdOut()
public byte[] getStderr()
protected void setStdOut(byte[] newOutput)
protected void setStdErr(byte[] newErr)
public byte[] getInput()
public void setInput(byte[] input)