class X::Proc::Async::TapBeforeSpawn is Exception {}

If the stdout or stderr methods of Proc::Async are called after the program has been started, an exception of type X::Proc::Async::TapBeforeSpawn is thrown.

my $proc = Proc::Async.new("echo""foo");
$proc.start;
$proc.stdout.tap(&print);
CATCH { default { put .^name''.Str } };
# OUTPUT: «X::Proc::Async::TapBeforeSpawn: To avoid data races, you must tap stdout before running the process␤»

The right way is the reverse order

my $proc = Proc::Async.new("echo""foo");
$proc.stdout.tap(&print);
await $proc.start;

Methods§

method handle§

method handle(X::Proc::Async::TapBeforeSpawn:D: --> Str:D)

Returns the name of the handle (stdout or stderr) that was accessed after the program started.