diff --git a/lib/foreman/process.rb b/lib/foreman/process.rb index 446989b..a470d7e 100644 --- a/lib/foreman/process.rb +++ b/lib/foreman/process.rb @@ -47,26 +47,24 @@ class Foreman::Process def run(options={}) env = @options[:env].merge(options[:env] || {}) output = options[:output] || $stdout - runner = "#{Foreman.runner}".gsub("'", "\\\\'") # To support directories with single quotes - cwdstr = "#{cwd}".gsub("'", "\\\\'") if Foreman.windows? Dir.chdir(cwd) do Process.spawn env, expanded_command(env), :out => output, :err => output end elsif Foreman.jruby_18? require "posix/spawn" - wrapped_command = "#{runner} -d '#{cwdstr}' -p -- #{command}" + wrapped_command = "#{Foreman.runner} -d #{cwd} -p -- #{command}".gsub("'", "\\\\'") 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 = "#{runner} -d '#{cwdstr}' -p -- #{command}" + wrapped_command = "#{Foreman.runner} -d #{cwd} -p -- #{command}".gsub("'", "\\\\'") Kernel.exec wrapped_command end else - wrapped_command = "#{Foreman.runner} -d '#{cwdstr}' -p -- #{command}" + wrapped_command = "#{Foreman.runner} -d #{cwd} -p -- #{command}".gsub("'", "\\\\'") Process.spawn env, wrapped_command, :out => output, :err => output end end