Package hudson
Class Proc.LocalProc
- java.lang.Object
-
- hudson.Proc
-
- hudson.Proc.LocalProc
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.Proc
Proc.LocalProc, Proc.ProcWithJenkins23271Patch, Proc.RemoteProc
-
-
Field Summary
Fields Modifier and Type Field Description static InputStreamSELFPUMP_INPUTstatic OutputStreamSELFPUMP_OUTPUT
-
Constructor Summary
Constructors Constructor Description LocalProc(String[] cmd, String[] env, InputStream in, OutputStream out)LocalProc(String[] cmd, String[] env, InputStream in, OutputStream out, File workDir)LocalProc(String[] cmd, String[] env, InputStream in, OutputStream out, OutputStream err, File workDir)LocalProc(String[] cmd, String[] env, OutputStream out, File workDir)LocalProc(String[] cmd, Map<String,String> env, InputStream in, OutputStream out)LocalProc(String cmd, String[] env, OutputStream out, File workDir)LocalProc(String cmd, Map<String,String> env, OutputStream out, File workDir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamgetStderr()Returns anInputStreamto read fromstderrof the child process.OutputStreamgetStdin()Returns anOutputStreamto write tostdinof the child process.InputStreamgetStdout()Returns anInputStreamto read fromstdoutof the child process.booleanisAlive()Checks if the process is still alive.intjoin()Waits for the completion of the process.voidkill()Terminates the process.-
Methods inherited from class hudson.Proc
joinWithTimeout
-
-
-
-
Field Detail
-
SELFPUMP_INPUT
public static final InputStream SELFPUMP_INPUT
-
SELFPUMP_OUTPUT
public static final OutputStream SELFPUMP_OUTPUT
-
-
Constructor Detail
-
LocalProc
public LocalProc(String cmd, Map<String,String> env, OutputStream out, File workDir) throws IOException
- Throws:
IOException
-
LocalProc
public LocalProc(String[] cmd, Map<String,String> env, InputStream in, OutputStream out) throws IOException
- Throws:
IOException
-
LocalProc
public LocalProc(String cmd, String[] env, OutputStream out, File workDir) throws IOException
- Throws:
IOException
-
LocalProc
public LocalProc(String[] cmd, String[] env, OutputStream out, File workDir) throws IOException
- Throws:
IOException
-
LocalProc
public LocalProc(String[] cmd, String[] env, InputStream in, OutputStream out) throws IOException
- Throws:
IOException
-
LocalProc
public LocalProc(String[] cmd, String[] env, InputStream in, OutputStream out, File workDir) throws IOException
- Throws:
IOException
-
LocalProc
public LocalProc(String[] cmd, String[] env, InputStream in, OutputStream out, OutputStream err, File workDir) throws IOException
- Parameters:
err- null to redirect stderr to stdout.- Throws:
IOException
-
-
Method Detail
-
getStdout
public InputStream getStdout()
Description copied from class:ProcReturns anInputStreamto read fromstdoutof the child process.When this method returns null,
Procwill internally pump the output from the child process to yourOutputStreamof choosing.- Specified by:
getStdoutin classProc- Returns:
nullunlessLauncher.ProcStarter.readStdout()is used to indicate that the caller intends to pump the stream by itself.
-
getStderr
public InputStream getStderr()
Description copied from class:ProcReturns anInputStreamto read fromstderrof the child process.When this method returns null,
Procwill internally pump the output from the child process to yourOutputStreamof choosing.- Specified by:
getStderrin classProc- Returns:
nullunlessLauncher.ProcStarter.readStderr()is used to indicate that the caller intends to pump the stream by itself.
-
getStdin
public OutputStream getStdin()
Description copied from class:ProcReturns anOutputStreamto write tostdinof the child process.When this method returns null,
Procwill internally pump theInputStreamof your choosing to the child process.- Specified by:
getStdinin classProc- Returns:
nullunlessLauncher.ProcStarter.writeStdin()is used to indicate that the caller intends to pump the stream by itself.
-
join
public int join() throws InterruptedException, IOExceptionWaits for the completion of the process.- Specified by:
joinin classProc- Throws:
IOException- if there's an error launching/joining a process and a stack trace could help the trouble-shooting.InterruptedException
-
isAlive
public boolean isAlive() throws IOException, InterruptedExceptionDescription copied from class:ProcChecks if the process is still alive.- Specified by:
isAlivein classProc- Throws:
IOExceptionInterruptedException
-
kill
public void kill() throws InterruptedException, IOExceptionDescription copied from class:ProcTerminates the process.- Specified by:
killin classProc- Throws:
IOException- if there's an error killing a process and a stack trace could help the trouble-shooting.InterruptedException
-
-