Rules / Types, classes & roles / exception

X::Proc::Async::TapBeforeSpawn Reference

Error due to tapping a Proc::Async stream after spawning its process

What it is #

Routines #

Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.

method handle #

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

Returns Str:D.

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

Examples, run three ways #

Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.

1 all-differ · 2 no-output

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

Not executed: the documentation states no expected output for this example.

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␤»
Documentation
X::Proc::Async::TapBeforeSpawn: To avoid data races, you must tap stdout before running the process
Rakudo
X::Proc::Async::TapBeforeSpawn: To avoid data races, you must tap stdout before running the process
foo
Raku++

All three differ. Needs a human.

Not yet examined. Which of these is correct has not been established — do not treat either engine as settled here.

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

Not executed: the documentation states no expected output for this example.