use a forked process to exec a run with environment

This commit is contained in:
David Dollar
2012-08-14 17:07:39 -04:00
parent 497b5ea1eb
commit 612eae5e21
+10 -7
View File
@@ -75,14 +75,17 @@ class Foreman::CLI < Thor
def run(*args)
load_environment!
begin
process = Foreman::Process.new(args.shelljoin, :env => engine.env)
process.run
rescue Errno::EACCES
error "not executable: #{args.first}"
rescue Errno::ENOENT
error "command not found: #{args.first}"
pid = fork do
begin
engine.env.each { |k,v| ENV[k] = v }
exec args.shelljoin
rescue Errno::EACCES
error "not executable: #{args.first}"
rescue Errno::ENOENT
error "command not found: #{args.first}"
end
end
Process.wait(pid)
end
desc "version", "Display Foreman gem version"