ProcGroup
A group of processes that are piped together, corresponding to e.g. ls -l | grep .scala
. You can create a ProcGroup
by calling .pipeTo
on a proc multiple times. Contains methods corresponding to the methods on proc, but defined for pipelines of processes.
Attributes
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
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
.
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:
Value parameters
- check
-
disable this to avoid throwing an exception if the pipeline fails with a non-zero exit code
- cwd
-
the working directory of the pipeline
- env
-
any additional environment variables you wish to set in the pipeline
- handleBrokenPipe
-
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.
- mergeErrIntoOut
-
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.
- pipefail
-
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.
- propagateEnv
-
disable this to avoid passing in this parent process's environment variables to the pipeline
- stderr
-
How the process's error stream is configured (set for all processes)
- stdin
-
any data you wish to pass to the pipelines's standard input (to the first process)
- stdout
-
How the pipelines's output stream is configured (the last process stdout)
- timeout
-
how long to wait in milliseconds for the pipeline to complete
- timeoutGracePeriod
-
if the timeout is enabled, how long in milliseconds for the subprocess to gracefully terminate before attempting to forcibly kill it (-1 for no kill, 0 for always kill immediately)
Attributes
- Note
-
the issuing of
SIGTERM
instead ofSIGKILL
is implementation dependent on your JVM version. Pre-Java 9, noSIGTERM
may be issued. Check the documentation for your JDK'sProcess.destroy
.
Pipes the output of this pipeline into the input of the next process.
Pipes the output of this pipeline into the input of the next process.
Attributes
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.
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!
Value parameters
- cwd
-
the working directory of the pipeline
- env
-
any additional environment variables you wish to set in the pipeline
- handleBrokenPipe
-
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.
- mergeErrIntoOut
-
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.
- pipefail
-
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.
- propagateEnv
-
disable this to avoid passing in this parent process's environment variables to the pipeline
- stderr
-
How the process's error stream is configured (set for all processes)
- stdin
-
any data you wish to pass to the pipelines's standard input (to the first process)
- stdout
-
How the pipelines's output stream is configured (the last process stdout)