diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-14 12:01:50 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-14 12:01:50 +0000 |
commit | 433fbebfbc49c330b66089f6d191558b967a84f5 (patch) | |
tree | d123587eb0b666e9300c36080de5b267f9f4abc2 /bootstraptest/test_io.rb | |
parent | a5c05a9ace5aad5fa9fc545be0be829cf61b16c4 (diff) |
* io.c (io_reopen): check STDIN, STDOUT and STDERR mode according to
stdio streams.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 +} |