Invokes the given pipeline like a function, passing in input and returning a CommandResult.
Invokes the given pipeline like a function, passing in input and returning a
CommandResult. You can then call result.exitCode
to see how it exited, or
result.out.bytes
or result.err.string
to access the aggregated stdout and
stderr of the subprocess in a number of convenient ways. If a non-zero exit code
is returned, this throws a os.SubprocessException containing the
CommandResult, unless you pass in check = false
.
For each process in pipeline, the output will be forwarded to the input of the next process. Input of the first process is set to provided stdin The output of the last process will be returned as the output of the pipeline. stderr is set for all processes.
call
provides a number of parameters that let you configure how the pipeline
is run:
the working directory of the pipeline
any additional environment variables you wish to set in the pipeline
any data you wish to pass to the pipelines's standard input (to the first process)
How the pipelines's output stream is configured (the last process stdout)
How the process's error stream is configured (set for all processes)
merges the pipeline's stderr stream into it's stdout. Note that then the stderr will be forwarded with stdout to subsequent processes in the pipeline.
how long to wait in milliseconds for the pipeline to complete
disable this to avoid throwing an exception if the pipeline fails with a non-zero exit code
disable this to avoid passing in this parent process's environment variables to the pipeline
if true, the pipeline's exitCode will be the exit code of the first failing process. If no process fails, the exit code will be 0.
if true, every java.io.IOException when redirecting output of a process will be caught and handled by killing the writing process. This behaviour is consistent with handlers of SIGPIPE signals in most programs supporting interruptable piping. Disabled by default on Windows.
Pipes the output of this pipeline into the input of the next process.
The most flexible of the os.ProcGroup calls.
The most flexible of the os.ProcGroup calls. It sets-up a pipeline of processes, and returns a ProcessPipeline for you to interact with however you like.
Note that if you provide ProcessOutput
callbacks to stdout
/stderr
,
the calls to those callbacks take place on newly spawned threads that
execute in parallel with the main thread. Thus make sure any data
processing you do in those callbacks is thread safe!
the working directory of the pipeline
any additional environment variables you wish to set in the pipeline
any data you wish to pass to the pipelines's standard input (to the first process)
How the pipelines's output stream is configured (the last process stdout)
How the process's error stream is configured (set for all processes)
merges the pipeline's stderr stream into it's stdout. Note that then the stderr will be forwarded with stdout to subsequent processes in the pipeline.
disable this to avoid passing in this parent process's environment variables to the pipeline
if true, the pipeline's exitCode will be the exit code of the first failing process. If no process fails, the exit code will be 0.
if true, every java.io.IOException when redirecting output of a process will be caught and handled by killing the writing process. This behaviour is consistent with handlers of SIGPIPE signals in most programs supporting interruptable piping. Disabled by default on Windows.
A group of processes that are piped together, corresponding to e.g.
ls -l | grep .scala
. You can create aProcGroup
by calling.pipeTo
on a proc multiple times. Contains methods corresponding to the methods on proc, but defined for pipelines of processes.