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

This commit is contained in:
Klaas Jan Wierenga committed 2013-05-02 12:39:23 +02:00
1 parent 9b4bd10cdb
commit 75b782b664
3 files changed
+14 -12

No files matched your search

+12 -2
View File
@@ -36,7 +36,12 @@ end
def forked_foreman(args)
rd, wr = make_pipe
Process.spawn("bundle exec bin/foreman #{args}", :out => wr, :err => wr)
if Foreman.jruby_18? || Foreman.ruby_18?
require 'posix/spawn'
POSIX::Spawn.spawn({}, "bundle exec bin/foreman #{args}", :out => wr, :err => wr)
else
Process.spawn("bundle exec bin/foreman #{args}", :out => wr, :err => wr)
end
wr.close
rd.read
end
@@ -61,7 +66,12 @@ def fork_and_capture(&blk)
end
def fork_and_get_exitstatus(args)
pid = Process.spawn("bundle exec bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
pid = if Foreman.jruby_18? || Foreman.ruby_18?
require 'posix/spawn'
POSIX::Spawn.spawn({}, "bundle exec bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
else
Process.spawn("bundle exec bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
end
Process.wait(pid)
$?.exitstatus
end