mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/io/console/test_io_console.rb (TestIO_Console#test_noctty):
split for each platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b6135f1cd7
commit
7905fc1e54
1 changed files with 11 additions and 7 deletions
|
@ -168,18 +168,22 @@ end if defined?(PTY) and defined?(IO::console)
|
||||||
class TestIO_Console < Test::Unit::TestCase
|
class TestIO_Console < Test::Unit::TestCase
|
||||||
require_relative '../../ruby/envutil'
|
require_relative '../../ruby/envutil'
|
||||||
|
|
||||||
|
case
|
||||||
|
when Process.respond_to?(:daemon)
|
||||||
def test_noctty
|
def test_noctty
|
||||||
if Process.respond_to?(:daemon)
|
|
||||||
assert_in_out_err(["-rio/console"],
|
assert_in_out_err(["-rio/console"],
|
||||||
"Process.daemon(true, true); p IO.console",
|
"Process.daemon(true, true); p IO.console",
|
||||||
["nil"])
|
["nil"])
|
||||||
elsif !(rubyw = RbConfig::CONFIG["RUBYW_INSTALL_NAME"]).empty?
|
end
|
||||||
|
when !(rubyw = RbConfig::CONFIG["RUBYW_INSTALL_NAME"]).empty?
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
dir, base = File.split(EnvUtil.rubybin)
|
||||||
|
RUBYW = File.join(dir, base.sub(/ruby/, rubyw))
|
||||||
|
|
||||||
|
def test_noctty
|
||||||
t = Tempfile.new("console")
|
t = Tempfile.new("console")
|
||||||
t.close
|
t.close
|
||||||
dir, base = File.split(EnvUtil.rubybin)
|
cmd = [RUBYW, '-rio/console', '-e', 'STDOUT.reopen(ARGV[0]); p IO.console', '--', t.path]
|
||||||
rubywbin = File.join(dir, base.sub(/ruby/, rubyw))
|
|
||||||
cmd = [rubywbin, '-rio/console', '-e', 'STDOUT.reopen(ARGV[0]); p IO.console', '--', t.path]
|
|
||||||
system(*cmd)
|
system(*cmd)
|
||||||
t.open
|
t.open
|
||||||
assert_equal("nil", t.gets.chomp)
|
assert_equal("nil", t.gets.chomp)
|
||||||
|
|
Loading…
Reference in a new issue