1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

MRI compatible code for ActiveSupport::Testing::Isolation::Subprocess

This commit is contained in:
Alexey Gaziev 2015-04-19 12:18:16 +08:00
parent c8bab30ce5
commit 61103ac7b0

View file

@ -69,17 +69,17 @@ module ActiveSupport
else else
Tempfile.open("isolation") do |tmpfile| Tempfile.open("isolation") do |tmpfile|
env = { env = {
ISOLATION_TEST: self.class.name, 'ISOLATION_TEST' => self.class.name,
ISOLATION_OUTPUT: tmpfile.path 'ISOLATION_OUTPUT' => tmpfile.path
} }
load_paths = $-I.map {|p| "-I\"#{File.expand_path(p)}\"" }.join(" ") load_paths = $-I.map {|p| "-I\"#{File.expand_path(p)}\"" }.join(" ")
orig_args = ORIG_ARGV.join(" ") orig_args = ORIG_ARGV.join(" ")
test_opts = "-n#{self.class.name}##{self.name}" test_opts = "-n#{self.class.name}##{self.name}"
command = "#{Gem.ruby} #{load_paths} #{$0} #{orig_args} #{test_opts}" command = "#{Gem.ruby} #{load_paths} #{$0} '#{orig_args}' #{test_opts}"
# IO.popen lets us pass env in a cross-platform way # IO.popen lets us pass env in a cross-platform way
child = IO.popen([env, command]) child = IO.popen(env, command)
begin begin
Process.wait(child.pid) Process.wait(child.pid)