是否 IO::Select在 Windows 中使用文件句柄?
$pid = open $handle, "-|", "$_command" || die "Cannot run $_command";
my $s = IO::Select->new();
$s->add($handle);
$s->add(\*STDIN);
while (1) {
@ready = $s->can_read(30);
if (scalar(@ready) > 0) {
}
else {
}
}
我的脚本不断在屏幕上打印一些东西,打开后,命令在后台启动,但 can_read
在 Windows 上总是失败。有什么帮助吗?
最佳答案
查看 PerlMonks thread :
select
(the underlying system call used byIO::Select
) only works for sockets in Windows.
The
select
function determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O.
关于perl - Perl 的 IO::Select 在 Windows 中是否与文件句柄一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1700007/