我正在使用
IO::Select
.
我没想到只有当我手动终止分叉进程时才会终止此代码.这是正确的行为吗?
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";