# New Ticket Created by  Aleks-Daniel Jakimenko-Aleksejev 
# Please include the string:  [perl #130370]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130370 >


This is probably best demonstrated by a code snippet.

Code:

my $out = Channel.new;
#my $proc = Proc::Async.new(‘perl6’, ‘-e’, ‘sleep ∞’); # ← this works
my $proc = Proc::Async.new(‘perl6’, ‘-e’, ‘.say for 0..0x1FFFF’); # ← this 
doesn't
$proc.stdout.tap({ $out.send: 1 });

my $promise = $proc.start;
say ‘let's await  ’, now;
await Promise.anyof(Promise.in(1), $promise);
say ‘let's close  ’, now;
$proc.kill;
await $promise;
$out.close;
say ‘that's it ’, now;


The idea is that we want to kill our process if it is still working after 1 
second. This works fine, unless the process is writing a lot of stuff to stdout.

IRC log: https://irclog.perlgeek.de/perl6/2016-12-18#i_13760994

Reply via email to