Error due to tapping a Proc::Async stream after spawning its process
is Exception
If the stdout
or stderr
methods of Proc::Async are called after the program has been start
ed, an exception of type X::Proc::Async::TapBeforeSpawn is thrown.
my = Proc::Async.new("echo", "foo");.start;.stdout.tap();CATCH ;# 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::Async.new("echo", "foo");.stdout.tap();await .start;
method handle(X::Proc::Async::TapBeforeSpawn: --> Str)
Returns the name of the handle (stdout
or stderr
) that was accessed after the program started.