diff options
Diffstat (limited to 'bootstraptest/test_io.rb')
-rw-r--r-- | bootstraptest/test_io.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb index 55b7ce01cb..a5d54afc5b 100644 --- a/bootstraptest/test_io.rb +++ b/bootstraptest/test_io.rb @@ -36,3 +36,19 @@ assert_finish 1, %q{ } r.gets("abab") } + +assert_equal 'ok', %q{ + require 'tmpdir' + begin + tmpname = "#{Dir.tmpdir}/ruby-btest-#{$$}-#{rand(0x100000000).to_s(36)}" + rw = File.open(tmpname, File::RDWR|File::CREAT|File::EXCL) + rescue Errno::EEXIST + retry + end + save = STDIN.dup + STDIN.reopen(rw) + STDIN.reopen(save) + rw.close + File.unlink(tmpname) + :ok +} |