Advertisement
Guest User

Untitled

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