mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix IO#scanf on pipes on Windows
IO.seek on a pipe on Windows raises Errno::EINVAL instead of Errno::ESPIPE. Fixes Ruby Bug #15199
This commit is contained in:
parent
e572ff2f95
commit
d118c84b0b
2 changed files with 8 additions and 1 deletions
|
@ -660,7 +660,7 @@ class IO
|
|||
|
||||
begin
|
||||
seek(start_position + matched_so_far, IO::SEEK_SET)
|
||||
rescue Errno::ESPIPE
|
||||
rescue Errno::ESPIPE, Errno::EINVAL
|
||||
end
|
||||
|
||||
soak_up_spaces if fstr.last_spec && fstr.space
|
||||
|
|
|
@ -17,5 +17,12 @@ class TestScanfIO < Test::Unit::TestCase
|
|||
ensure
|
||||
fh.close
|
||||
end
|
||||
|
||||
def test_pipe_scanf
|
||||
r, w = IO.pipe
|
||||
w.write('a')
|
||||
w.close
|
||||
assert_equal([], r.scanf('a'))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue