Guest User

Untitled

a guest
Mar 17th, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. my Supplier::Preserving $supplier .= new;
  2. my Supply $out-supply = $supplier.Supply;
  3.  
  4. my Proc::Async $proc-async .= new(</bin/false>);
  5. $proc-async.stdout.lines.tap({ say 'forwarding ' ~ $_; $supplier.emit($_) });
  6.  
  7. start {
  8. my Proc $done-proc = await $proc-async.start;
  9. say 'process exited';
  10. if $done-proc.exitcode != 0 {
  11. say 'bad exit code';
  12. $supplier.emit(
  13. Failure.new(
  14. "Process exited with non-zero exit code: {$done-proc.exitcode}"
  15. )
  16. );
  17. }
  18. say 'done';
  19. $supplier.done;
  20. }
  21.  
  22. say 'i have control';
  23. say $out-supply.list.Array;
Advertisement
Add Comment
Please, Sign In to add comment