wrap command in a runner that sources .profile.d scripts

This commit is contained in:
David Dollar
2012-07-24 11:09:54 -04:00
parent 7d9c2b2ac4
commit 584f251e4a
3 changed files with 29 additions and 18 deletions
+12 -15
View File
@@ -43,23 +43,20 @@ class Foreman::Process
Process.spawn env, expanded_command, :out => output, :err => output
end
elsif Foreman.jruby?
Dir.chdir(cwd) do
require "posix/spawn"
POSIX::Spawn.spawn env, command, :out => output, :err => output
end
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?
Dir.chdir(cwd) do
fork do
$stdout.reopen output
$stderr.reopen output
env.each { |k,v| ENV[k] = v }
exec command
end
fork do
$stdout.reopen output
$stderr.reopen output
env.each { |k,v| ENV[k] = v }
wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
exec wrapped_command
end
else
Dir.chdir(cwd) do
Process.spawn env, command, :out => output, :err => output
end
wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
Process.spawn env, wrapped_command, :out => output, :err => output
end
end
@@ -96,7 +93,7 @@ class Foreman::Process
private
def cwd
@options[:cwd] || "."
File.expand_path(@options[:cwd] || ".")
end
end