From 1e4a9554358d15dd00fbb2edeb0bf80866d7b7c4 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 14 Dec 2013 02:55:33 +0000 Subject: scanf.rb: fix rescue modifier * lib/scanf.rb (IO#scanf): fix mistaken use of rescue modifier. a patch by Mon_Ouie at [ruby-core:52813]. [Bug #7940] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/scanf.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/scanf.rb') diff --git a/lib/scanf.rb b/lib/scanf.rb index 199eb16cce..4827df1e42 100644 --- a/lib/scanf.rb +++ b/lib/scanf.rb @@ -657,7 +657,12 @@ class IO break if fstr.last_spec fstr.prune end - seek(start_position + matched_so_far, IO::SEEK_SET) rescue Errno::ESPIPE + + begin + seek(start_position + matched_so_far, IO::SEEK_SET) + rescue Errno::ESPIPE + end + soak_up_spaces if fstr.last_spec && fstr.space return final_result -- cgit v1.2.3