I use IO::Select.
I did not expect this code to end only when I manually kill the forked process. Is this the right behavior?
use strict;
use warnings;
STDOUT->autoflush();
use IO::Select;
open(my $ph, "-|", "perl -e 'sleep 1 while 1'");
my $sel = IO::Select->new();
$sel->add($ph);
$sel->can_read(2) or warn "timeout\n";
print "woohoo?\n";
Dry27 source
share