|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.Proc
public abstract class Proc
External process wrapper.
Used for launching, monitoring, waiting for a process.
Nested Class Summary | |
---|---|
static class |
Proc.LocalProc
Locally launched process. |
static class |
Proc.RemoteProc
Deprecated. as of 1.399. Replaced by Launcher.RemoteLauncher.ProcImpl |
Field Summary | |
---|---|
static boolean |
SHOW_PID
Debug switch to have the thread display the process it's waiting for. |
Constructor Summary | |
---|---|
protected |
Proc()
|
Method Summary | |
---|---|
abstract InputStream |
getStderr()
Returns an InputStream to read from stderr of the child process. |
abstract OutputStream |
getStdin()
Returns an OutputStream to write to stdin of the child process. |
abstract InputStream |
getStdout()
Returns an InputStream to read from stdout of the child process. |
abstract boolean |
isAlive()
Checks if the process is still alive. |
abstract int |
join()
Waits for the completion of the process. |
int |
joinWithTimeout(long timeout,
TimeUnit unit,
TaskListener listener)
Like join() but can be given a maximum time to wait. |
abstract void |
kill()
Terminates the process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean SHOW_PID
Constructor Detail |
---|
protected Proc()
Method Detail |
---|
public abstract boolean isAlive() throws IOException, InterruptedException
IOException
InterruptedException
public abstract void kill() throws IOException, InterruptedException
IOException
- if there's an error killing a process
and a stack trace could help the trouble-shooting.
InterruptedException
public abstract int join() throws IOException, InterruptedException
getStdout()
etc.,
this method also blocks until we finish reading everything that the process has produced
to stdout/stderr.
If the thread is interrupted while waiting for the completion of the process, this method terminates the process and exits with a non-zero exit code.
IOException
- if there's an error launching/joining a process
and a stack trace could help the trouble-shooting.
InterruptedException
public abstract InputStream getStdout()
InputStream
to read from stdout
of the child process.
When this method returns null, Proc.LocalProc
will internally pump the output from
the child process to your OutputStream
of choosing.
Launcher.ProcStarter.readStdout()
is used to indicate
that the caller intends to pump the stream by itself.public abstract InputStream getStderr()
InputStream
to read from stderr
of the child process.
When this method returns null, Proc.LocalProc
will internally pump the output from
the child process to your OutputStream
of choosing.
Launcher.ProcStarter.readStderr()
is used to indicate
that the caller intends to pump the stream by itself.public abstract OutputStream getStdin()
OutputStream
to write to stdin
of the child process.
When this method returns null, Proc.LocalProc
will internally pump the InputStream
of your choosing to the child process.
Launcher.ProcStarter.writeStdin()
is used to indicate
that the caller intends to pump the stream by itself.public final int joinWithTimeout(long timeout, TimeUnit unit, TaskListener listener) throws IOException, InterruptedException
join()
but can be given a maximum time to wait.
timeout
- number of time unitsunit
- unit of timelistener
- place to send messages if there are problems, incl. timeout
IOException
- for the same reasons as join()
InterruptedException
- for the same reasons as join()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |