operator | method
Pipes this script's stdout into other
's stdin.
The other
must be either a Script or an object that can be converted
into a script using the Script.fromByteTransformer and
Script.fromLineTransformer constructors.
Returns a new Script whose stdin comes from this and whose stdout
and stderr come from other
.
This behaves like a Bash pipeline with set -o pipefail
: if either this
or other
exits with a non-zero exit code, the returned script will fail,
but it will only exit once both component scripts have exited. If both
exit with errors, other
's exit code will be used.
This doesn't add any special handling for this's stderr.
See also pipe
, which provides a syntax for creating a pipeline with many
scripts at once.
Implementation
Script operator |(Object other) => Script.pipeline([this, other]);