On Sat, 13 May 2017 12:32:37 -0700, richard.hogab...@gmail.com wrote: > Attached is a file illustrating a possible bug with the await routine. > Just read the comments and run the code with one of two possible > statements commented in. >
Thank you for the report. However, there's no bug here. The Promise returned by Proc::Async.start[^1] returns the Proc[^2] object, which throws[^3] an exception when it's sunk and the exit status of the program was not successful. This is what happens in your first statement, so the error you see on your screen is from an exception thrown by Proc and your program exits right then and there, so you never get to the part where you check the $out/$err contents. In the second statement, the `my $rc` prevents[^4] the sinking of the Proc, so it never explodes and your program continues until the end, handling $out/$err and writing stuff to the file. If $rc is useless, simply use an anon var: `$ = await ...` instead of `my $rc = await ...` [1] https://docs.perl6.org/type/Proc::Async#method_start [2] https://docs.perl6.org/type/Proc [3] https://docs.perl6.org/type/Proc#method_sink [4] https://docs.perl6.org/language/traps#Sunk_Proc