1
0
Fork 0
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:
Jeremy Evans 2019-06-14 17:50:31 -07:00 committed by Hiroshi SHIBATA
parent e572ff2f95
commit d118c84b0b
2 changed files with 8 additions and 1 deletions

View file

@ -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

View file

@ -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