Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my Proc::Async $proc-async .= new(</bin/false>);
- my Supply $supply-lines = $proc-async.stdout.lines;
- my Promise $promise-done = $proc-async.start;
- my Supply $out-supply = supply {
- whenever $supply-lines -> Str $line {
- say 'forwarding ' ~ $line;
- emit $line;
- }
- whenever $promise-done -> Proc $done-proc {
- if $done-proc.exitcode != 0 {
- say 'bad exit code';
- emit(
- Failure.new(
- "Process exited with non-zero exit code: {$done-proc.exitcode}"
- )
- );
- }
- say 'done';
- }
- }
- say 'i have control';
- say $out-supply.list.Array;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement