summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-26 14:18:58 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-26 14:18:58 +0000
commit662a3ca8064d973a4f96184d2598741b6ee3c7ae (patch)
tree5f9c568001929d5e08e17a5a0239b2dec6632725
parentd65f94634cf52f6821e0c1c0911b88845b71d502 (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.rb2
-rw-r--r--test/scanf/test_scanfio.rb7
-rw-r--r--version.h2
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
diff --git a/version.h b/version.h
index d69e3af728..142ea40436 100644
--- a/version.h
+++ b/version.h
@@ -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