forked from Perl/perl5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
readline: clear the error flag if the error happens to be EAGAIN
(or the equivalent EWOULDBLOCK) This allows questionable code that tries to combine select and the readline flavour of buffered I/O to limp along. Such code is still risky due to select() checking the underlying OS handle and not the perl handle. Fixes Perl#22883
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!./perl | ||
|
||
BEGIN { | ||
chdir 't' if -d 't'; | ||
require './test.pl'; | ||
set_up_inc('../lib'); | ||
require Config; Config->import; | ||
|
||
skip_all_if_miniperl(); | ||
} | ||
|
||
use strict; | ||
use IO::Select; | ||
|
||
$Config{d_pipe} | ||
or skip_all("No pipe"); | ||
|
||
my ($in, $out); | ||
pipe($in, $out) | ||
or skip_all("Cannot pipe: $!"); | ||
|
||
$in->blocking(0) | ||
or skip_all("Cannot make pipe non-blocking"); | ||
|
||
my $line = <$in>; | ||
is($line, undef, "error reading"); | ||
ok(!$in->error, "but did not set error flag"); | ||
close $out; | ||
$line = <$in>; | ||
is($line, undef, "nothing to read, but eof"); | ||
ok(!$in->error, "still did not set error flag"); | ||
ok($in->eof, "did set eof"); | ||
ok(close($in), "close success"); | ||
|
||
|
||
done_testing(); |