diff options
Diffstat (limited to 'bootstraptest/test_io.rb')
-rw-r--r-- | bootstraptest/test_io.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb index a5d54afc5b..4974a1eeb9 100644 --- a/bootstraptest/test_io.rb +++ b/bootstraptest/test_io.rb @@ -52,3 +52,20 @@ assert_equal 'ok', %q{ File.unlink(tmpname) :ok } + +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.print "a" + STDIN.reopen(save) + rw.close + File.unlink(tmpname) + :ok +} |