mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
On Windows it cannot receive fd except 0..2
This commit is contained in:
parent
0529fead36
commit
9b9a621ae3
1 changed files with 15 additions and 7 deletions
|
@ -110,11 +110,16 @@ module Test
|
||||||
file ||= loc.path
|
file ||= loc.path
|
||||||
line ||= loc.lineno
|
line ||= loc.lineno
|
||||||
end
|
end
|
||||||
|
if /mswin|mingw/ =~ RUBY_PLATFORM
|
||||||
|
res_fd = 1 # STDOUT
|
||||||
|
else
|
||||||
res_p, res_c = IO.pipe
|
res_p, res_c = IO.pipe
|
||||||
opt[res_c.fileno] = res_c.fileno
|
opt[res_c.fileno] = res_c.fileno
|
||||||
|
res_fd = res_c.fileno
|
||||||
|
end
|
||||||
src = <<eom
|
src = <<eom
|
||||||
# -*- coding: #{line += __LINE__; src.encoding}; -*-
|
# -*- coding: #{line += __LINE__; src.encoding}; -*-
|
||||||
require "test/unit";out=IO.new(#{res_c.fileno});include Test::Unit::Assertions;require #{(__dir__ + "/core_assertions").dump};include Test::Unit::CoreAssertions
|
require "test/unit";out=IO.new(#{res_fd});include Test::Unit::Assertions;require #{(__dir__ + "/core_assertions").dump};include Test::Unit::CoreAssertions
|
||||||
END {
|
END {
|
||||||
out.puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}"
|
out.puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}"
|
||||||
}
|
}
|
||||||
|
@ -130,10 +135,13 @@ eom
|
||||||
assert(!abort, FailDesc[status, nil, stderr])
|
assert(!abort, FailDesc[status, nil, stderr])
|
||||||
self._assertions += stdout[/^assertions=(\d+)/, 1].to_i
|
self._assertions += stdout[/^assertions=(\d+)/, 1].to_i
|
||||||
begin
|
begin
|
||||||
|
if res_c
|
||||||
res_c.close
|
res_c.close
|
||||||
puts stdout
|
print stdout
|
||||||
STDERR.puts stderr
|
|
||||||
res = Marshal.load(res_p.read.unpack("m")[0])
|
res = Marshal.load(res_p.read.unpack("m")[0])
|
||||||
|
else
|
||||||
|
res = Marshal.load(stdout.unpack("m")[0])
|
||||||
|
end
|
||||||
rescue => marshal_error
|
rescue => marshal_error
|
||||||
ignore_stderr = nil
|
ignore_stderr = nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue