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 | 74fe9071144766a97486df49fae5c22e07e64d90 (patch) | |
tree | d123587eb0b666e9300c36080de5b267f9f4abc2 /bootstraptest/test_io.rb | |
parent | d8df0dd82d2eba38955154db63766cd2b568a95e (diff) | |
download | ruby-74fe9071144766a97486df49fae5c22e07e64d90.tar.gz ruby-74fe9071144766a97486df49fae5c22e07e64d90.tar.xz ruby-74fe9071144766a97486df49fae5c22e07e64d90.zip |
* io.c (io_reopen): check STDIN, STDOUT and STDERR mode according to
stdio streams.
git-svn-id: http://svn.ruby-lang.org/repos/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 a5d54afc5..4974a1eeb 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 +} |