diff options
-rw-r--r-- | lib/scanf.rb | 2 | ||||
-rw-r--r-- | test/scanf/test_scanfio.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/scanf.rb b/lib/scanf.rb index 42fa548025..23ebbbd842 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 |