开发者

Does Perl's IO::Select in Windows work with filehandles?

开发者 https://www.devze.com 2022-12-11 09:23 出处:网络
Does IO::Select in Windows work with filehandles? $pid = open $handle, \"-|\", \"$_command\" || die \"Cannot run $_command\";

Does IO::Select in Windows work with filehandles?

$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 {
    }
}

My script continuously prints something to the screen, with open, the command gets started in the background but can_read alwa开发者_开发百科ys fails on Windows. Any help?


See this PerlMonks thread:

select (the underlying system call used by IO::Select) only works for sockets in Windows.

MSDN docs for select confirm this:

The select function determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O.

0

精彩评论

暂无评论...
验证码 换一张
取 消