From 7ad41da59297e8b0816f719b77655175260a3428 Mon Sep 17 00:00:00 2001 From: Adam Hutchison Date: Tue, 27 Nov 2012 22:07:50 -0700 Subject: [PATCH] Since JRuby 1.9 doesn't require posix/spawn, only follow that path if JRuby is loaded and running in 1.8 mode. --- lib/foreman.rb | 4 ++-- lib/foreman/process.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/foreman.rb b/lib/foreman.rb index 888247a..6f81674 100644 --- a/lib/foreman.rb +++ b/lib/foreman.rb @@ -8,8 +8,8 @@ module Foreman File.expand_path("../../bin/foreman-runner", __FILE__) end - def self.jruby? - defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java" + def self.jruby_18? + defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java" and ruby_18? end def self.ruby_18? diff --git a/lib/foreman/process.rb b/lib/foreman/process.rb index 6ea3893..4069ed9 100644 --- a/lib/foreman/process.rb +++ b/lib/foreman/process.rb @@ -53,7 +53,7 @@ class Foreman::Process Dir.chdir(cwd) do Process.spawn env, expanded_command(env), :out => output, :err => output end - elsif Foreman.jruby? + elsif Foreman.jruby_18? require "posix/spawn" wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}" POSIX::Spawn.spawn env, wrapped_command, :out => output, :err => output