In Proc::Async§
See primary documentation in context for method stderr
method stderr(Proc::Async:D: :$bin --> Supply:D)
Returns the Supply
for the external program's standard error stream. If :bin
is passed, the standard error is passed along in binary as Blob
, otherwise it is interpreted as UTF-8, decoded, and passed along as Str
.
my $proc = Proc::Async.new(:r, 'echo', 'Raku'); $proc.stderr.tap( -> $str { say "Got error '$str' from the external program"; }); my $promise = $proc.start; await $promise;
You must call stderr
before you call .start
. Otherwise an exception of class X::Proc::Async::TapBeforeSpawn
is thrown.
If stderr
is not called, the external program's standard error stream is not captured at all.
Note that you cannot call stderr
both with and without :bin
on the same object; it will throw an exception of type X::Proc::Async::CharsOrBytes
if you try.
Use .Supply
for merged STDOUT and STDERR.