public class ExecProcess
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ExecProcess.MultiOutputStream
any bytes written to this are written to all of its arguments
|
Modifier and Type | Field and Description |
---|---|
static java.io.OutputStream |
devNull
an OutputStream that discards anything written to it
|
static java.io.InputStream |
eofInputStream
an InputStream that always returns EOF
|
Constructor and Description |
---|
ExecProcess(java.lang.String[] command,
java.io.File workingDirectory) |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
java.io.InputStream |
getStderr() |
java.io.OutputStream |
getStdin() |
java.io.InputStream |
getStdout() |
void |
redirectStderr(java.io.OutputStream os) |
void |
redirectStdin(java.io.InputStream in) |
void |
redirectStdout(java.io.OutputStream os) |
void |
setLocal()
undoes setRemote()
|
void |
setRemote(java.lang.String host,
java.lang.String user,
java.io.File remoteWorkingDirectory,
boolean syncBefore,
boolean syncAfter) |
void |
start() |
int |
waitFor() |
public static final java.io.OutputStream devNull
public static final java.io.InputStream eofInputStream
public ExecProcess(java.lang.String[] command, java.io.File workingDirectory)
command
- the command to run (separated into argv[])workingDirectory
- the working directory on the LOCAL machinepublic void setRemote(java.lang.String host, java.lang.String user, java.io.File remoteWorkingDirectory, boolean syncBefore, boolean syncAfter)
host
- the hostname to run onuser
- the username on the remote machine (or null to use
whatever default ssh chooses)remoteWorkingDirectory
- the directory to work in on the remote machinesyncBefore
- if true then "rsync --delete
workingDirectory host:remoteWorkingDirectory" before
invoking command.syncAfter
- if true and the command terminates with exit
code zero, then "rsync --delete
host:remoteWorkingDirectory workingDirectory" after
invoking command.public void setLocal()
public void redirectStdin(java.io.InputStream in)
public void redirectStdout(java.io.OutputStream os)
public void redirectStderr(java.io.OutputStream os)
public void start() throws java.io.IOException
java.io.IOException
public void destroy() throws java.io.IOException
java.io.IOException
public int waitFor() throws java.io.IOException
java.io.IOException
public java.io.OutputStream getStdin()
public java.io.InputStream getStdout()
public java.io.InputStream getStderr()