diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-08-26 14:18:58 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-08-26 14:18:58 +0000 |
commit | 662a3ca8064d973a4f96184d2598741b6ee3c7ae (patch) | |
tree | 5f9c568001929d5e08e17a5a0239b2dec6632725 | |
parent | d65f94634cf52f6821e0c1c0911b88845b71d502 (diff) |
merge revision(s) d118c84b0b9110462e479487ffaf175a75e5718e: [Backport #15199]
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
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/scanf.rb | 2 | ||||
-rw-r--r-- | test/scanf/test_scanfio.rb | 7 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/lib/scanf.rb b/lib/scanf.rb index 6bd7da4043..27e815d494 100644 --- a/lib/scanf.rb +++ b/lib/scanf.rb @@ -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 diff --git a/test/scanf/test_scanfio.rb b/test/scanf/test_scanfio.rb index cec8750aef..f7c439276d 100644 --- a/test/scanf/test_scanfio.rb +++ b/test/scanf/test_scanfio.rb @@ -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 @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.5.6" #define RUBY_RELEASE_DATE "2019-08-26" -#define RUBY_PATCHLEVEL 173 +#define RUBY_PATCHLEVEL 174 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 8 |