Use POSIX::Spawn to make foreman ruby 1.8 compatible and have all specs passing.

This commit is contained in:
Klaas Jan Wierenga
2013-05-02 12:39:23 +02:00
parent 9b4bd10cdb
commit 75b782b664
3 changed files with 14 additions and 12 deletions
+1 -9
View File
@@ -52,18 +52,10 @@ class Foreman::Process
Dir.chdir(cwd) do
Process.spawn env, expanded_command(env), :out => output, :err => output
end
elsif Foreman.jruby_18?
elsif Foreman.jruby_18? || Foreman.ruby_18?
require "posix/spawn"
wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
POSIX::Spawn.spawn env, wrapped_command, :out => output, :err => output
elsif Foreman.ruby_18?
fork do
$stdout.reopen output
$stderr.reopen output
env.each { |k,v| ENV[k] = v }
wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
Kernel.exec wrapped_command
end
else
wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
Process.spawn env, wrapped_command, :out => output, :err => output