mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/readline/test_readline.rb (TestReadline::replace_stdio):
merged the patch of [ruby-dev:25232] instead of [ruby-dev:25223]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1b3e17c592
commit
3cd403df5d
2 changed files with 21 additions and 13 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Sep 22 16:33:12 2005 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* test/readline/test_readline.rb (TestReadline::replace_stdio):
|
||||
merged the patch of [ruby-dev:25232] instead of [ruby-dev:25223].
|
||||
|
||||
Wed Sep 21 23:30:44 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/mkmf.rb (configuration): generalized nmake dependent code.
|
||||
|
|
|
@ -62,19 +62,22 @@ class TestReadline < Test::Unit::TestCase
|
|||
private
|
||||
|
||||
def replace_stdio(stdin_path, stdout_path)
|
||||
STDIN.seek(0, File::SEEK_SET) rescue nil
|
||||
orig_stdin = STDIN.dup
|
||||
orig_stdout = STDOUT.dup
|
||||
STDIN.reopen(stdin_path, "r")
|
||||
STDOUT.reopen(stdout_path, "w")
|
||||
begin
|
||||
yield
|
||||
ensure
|
||||
STDIN.reopen(orig_stdin)
|
||||
STDOUT.reopen(orig_stdout)
|
||||
orig_stdin.close
|
||||
orig_stdout.close
|
||||
end
|
||||
open(stdin_path, "r"){|stdin|
|
||||
open(stdout_path, "w"){|stdout|
|
||||
orig_stdin = STDIN.dup
|
||||
orig_stdout = STDOUT.dup
|
||||
STDIN.reopen(stdin)
|
||||
STDOUT.reopen(stdout)
|
||||
begin
|
||||
yield
|
||||
ensure
|
||||
STDIN.reopen(orig_stdin)
|
||||
STDOUT.reopen(orig_stdout)
|
||||
orig_stdin.close
|
||||
orig_stdout.close
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue