use a forked process to exec a run with environment
This commit is contained in:
+10
-7
@@ -75,14 +75,17 @@ class Foreman::CLI < Thor
|
|||||||
|
|
||||||
def run(*args)
|
def run(*args)
|
||||||
load_environment!
|
load_environment!
|
||||||
begin
|
pid = fork do
|
||||||
process = Foreman::Process.new(args.shelljoin, :env => engine.env)
|
begin
|
||||||
process.run
|
engine.env.each { |k,v| ENV[k] = v }
|
||||||
rescue Errno::EACCES
|
exec args.shelljoin
|
||||||
error "not executable: #{args.first}"
|
rescue Errno::EACCES
|
||||||
rescue Errno::ENOENT
|
error "not executable: #{args.first}"
|
||||||
error "command not found: #{args.first}"
|
rescue Errno::ENOENT
|
||||||
|
error "command not found: #{args.first}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Process.wait(pid)
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "version", "Display Foreman gem version"
|
desc "version", "Display Foreman gem version"
|
||||||
|
|||||||
Reference in New Issue
Block a user