|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.Launcher.ProcStarter
public final class Launcher.ProcStarter
Builder pattern for configuring a process to launch.
Field Summary | |
---|---|
protected List<String> |
commands
|
protected String[] |
envs
|
protected boolean[] |
masks
|
protected FilePath |
pwd
|
protected boolean |
reverseStderr
True to reverse the I/O direction. |
protected boolean |
reverseStdin
True to reverse the I/O direction. |
protected boolean |
reverseStdout
True to reverse the I/O direction. |
protected OutputStream |
stderr
|
protected InputStream |
stdin
|
protected OutputStream |
stdout
|
Constructor Summary | |
---|---|
Launcher.ProcStarter()
|
Method Summary | |
---|---|
Launcher.ProcStarter |
cmdAsSingleString(String s)
Passes a white-space separated single-string command (like "cat abc def") and parse them as a command argument. |
List<String> |
cmds()
|
Launcher.ProcStarter |
cmds(ArgumentListBuilder args)
|
Launcher.ProcStarter |
cmds(File program,
String... args)
|
Launcher.ProcStarter |
cmds(List<String> args)
|
Launcher.ProcStarter |
cmds(String... args)
|
Launcher.ProcStarter |
copy()
Copies a Launcher.ProcStarter . |
String[] |
envs()
|
Launcher.ProcStarter |
envs(Map<String,String> overrides)
Sets the environment variable overrides. |
Launcher.ProcStarter |
envs(String... overrides)
|
int |
join()
Starts the process and waits for its completion. |
boolean[] |
masks()
|
Launcher.ProcStarter |
masks(boolean... masks)
Hide parts of the command line from being printed to the log. |
FilePath |
pwd()
|
Launcher.ProcStarter |
pwd(File workDir)
|
Launcher.ProcStarter |
pwd(FilePath workDir)
|
Launcher.ProcStarter |
pwd(String workDir)
|
Launcher.ProcStarter |
readStderr()
In addition to the effect of readStdout() , indicate that the caller will pump stderr
from the child process separately from stdout . |
Launcher.ProcStarter |
readStdout()
Indicates that the caller will pump stdout from the child process
via Proc.getStdout() (whereas by default you call stdout(OutputStream)
and let Jenkins pump stdout into your OutputStream of choosing. |
Proc |
start()
Starts the new process as configured. |
OutputStream |
stderr()
|
Launcher.ProcStarter |
stderr(OutputStream err)
Controls where the stderr of the process goes. |
InputStream |
stdin()
|
Launcher.ProcStarter |
stdin(InputStream in)
Controls where the stdin of the process comes from. |
OutputStream |
stdout()
|
Launcher.ProcStarter |
stdout(OutputStream out)
|
Launcher.ProcStarter |
stdout(TaskListener out)
Sends the stdout to the given TaskListener . |
Launcher.ProcStarter |
writeStdin()
Indicates that the caller will directly write to the child process stdin() via Proc.getStdin() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<String> commands
protected boolean[] masks
protected FilePath pwd
protected OutputStream stdout
protected OutputStream stderr
protected InputStream stdin
protected String[] envs
protected boolean reverseStdin
reverseStdout
==true, then we expose
InputStream
from Proc
and expect the client to read from it,
whereas normally we take OutputStream
via stdout(OutputStream)
and feed stdout into that output.
protected boolean reverseStdout
reverseStdout
==true, then we expose
InputStream
from Proc
and expect the client to read from it,
whereas normally we take OutputStream
via stdout(OutputStream)
and feed stdout into that output.
protected boolean reverseStderr
reverseStdout
==true, then we expose
InputStream
from Proc
and expect the client to read from it,
whereas normally we take OutputStream
via stdout(OutputStream)
and feed stdout into that output.
Constructor Detail |
---|
public Launcher.ProcStarter()
Method Detail |
---|
public Launcher.ProcStarter cmdAsSingleString(String s)
public Launcher.ProcStarter cmds(String... args)
public Launcher.ProcStarter cmds(File program, String... args)
public Launcher.ProcStarter cmds(List<String> args)
public Launcher.ProcStarter cmds(ArgumentListBuilder args)
public List<String> cmds()
public Launcher.ProcStarter masks(boolean... masks)
masks
- true for each position in cmds(String[])
which should be masked, false to print
ArgumentListBuilder.add(String, boolean)
,
Launcher.maskedPrintCommandLine(List, boolean[], FilePath)
public boolean[] masks()
public Launcher.ProcStarter pwd(FilePath workDir)
public Launcher.ProcStarter pwd(File workDir)
public Launcher.ProcStarter pwd(String workDir)
public FilePath pwd()
public Launcher.ProcStarter stdout(OutputStream out)
public Launcher.ProcStarter stdout(TaskListener out)
TaskListener
.
public OutputStream stdout()
public Launcher.ProcStarter stderr(OutputStream err)
public OutputStream stderr()
public Launcher.ProcStarter stdin(InputStream in)
public InputStream stdin()
public Launcher.ProcStarter envs(Map<String,String> overrides)
In adition to what the current process is inherited (if this is going to be launched from a slave agent, that becomes the "current" process), these variables will be also set.
public Launcher.ProcStarter envs(String... overrides)
overrides
- List of "VAR=VALUE". See envs(Map)
for the semantics.public String[] envs()
public Launcher.ProcStarter readStdout()
stdout
from the child process
via Proc.getStdout()
(whereas by default you call stdout(OutputStream)
and let Jenkins pump stdout into your OutputStream
of choosing.
When this method is called, Proc.getStdout()
will read the combined output
of stdout/stderr
from the child process, unless readStderr()
is called
separately, which lets the caller read those two streams separately.
public Launcher.ProcStarter readStderr()
readStdout()
, indicate that the caller will pump stderr
from the child process separately from stdout
. The stderr will be readable from
Proc.getStderr()
while Proc.getStdout()
reads from stdout.
public Launcher.ProcStarter writeStdin()
stdin()
via Proc.getStdin()
.
(Whereas by default you call stdin(InputStream)
and let Jenkins pump your InputStream
of choosing to stdin.)
public Proc start() throws IOException
IOException
public int join() throws IOException, InterruptedException
IOException
InterruptedException
public Launcher.ProcStarter copy()
Launcher.ProcStarter
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |