Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.92k stars 548 forks source link

IO::Handle blocking always fails in windows [rt.cpan.org #53049] #17448

Open toddr opened 6 years ago

toddr commented 6 years ago

Migrated from rt.cpan.org#53049 (status was 'new')

Requestors:

Attachments:

From arvindsgulati@gmail.com on 2009-12-24 06:58:24:

In module IO::Handle using strawberry perl v5.10.0 on Windows 7 64 bit OS,
$io->blocking(0) always fails with $! set to "Unknown error"

Sample code to produce the bug is attached
toddr commented 4 years ago
#!/usr/bin/perl

use strict;
use warnings;
use IO::File;
print $! if(!STDIN->blocking(0)) ;
 $_ = <STDIN>;
if(defined) {
print "You were quick";
exit;
}
sleep 5;
 $_ = <STDIN>;
if(defined)
{
    print "Atleast you can type";
    exit;
}
print "You are totally useless";
tonycoz commented 4 years ago

Only sockets support setting non-blocking mode on Win32.

Otherwise I believe only named pipes can be made non-blocking, but neither the perl core nor IO provide an interface to Win32 named pipes.