Skip to content

Commit

Permalink
* test/io/console/test_io_console.rb (TestIO_Console#test_noctty):
Browse files Browse the repository at this point in the history
  split for each platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Jun 14, 2011
1 parent b6135f1 commit 7905fc1
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions test/io/console/test_io_console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,22 @@ def helper
class TestIO_Console < Test::Unit::TestCase
require_relative '../../ruby/envutil'

def test_noctty
if Process.respond_to?(:daemon)
case
when Process.respond_to?(:daemon)
def test_noctty
assert_in_out_err(["-rio/console"],
"Process.daemon(true, true); p IO.console",
["nil"])
elsif !(rubyw = RbConfig::CONFIG["RUBYW_INSTALL_NAME"]).empty?
require 'tempfile'
end
when !(rubyw = RbConfig::CONFIG["RUBYW_INSTALL_NAME"]).empty?
require 'tempfile'
dir, base = File.split(EnvUtil.rubybin)
RUBYW = File.join(dir, base.sub(/ruby/, rubyw))

def test_noctty
t = Tempfile.new("console")
t.close
dir, base = File.split(EnvUtil.rubybin)
rubywbin = File.join(dir, base.sub(/ruby/, rubyw))
cmd = [rubywbin, '-rio/console', '-e', 'STDOUT.reopen(ARGV[0]); p IO.console', '--', t.path]
cmd = [RUBYW, '-rio/console', '-e', 'STDOUT.reopen(ARGV[0]); p IO.console', '--', t.path]
system(*cmd)
t.open
assert_equal("nil", t.gets.chomp)
Expand Down

0 comments on commit 7905fc1

Please sign in to comment.