don't fork on 'run'
This removes the fork when doing `foreman run`. The fork results in an unnecessary process laying around. The parent process doesn't do anything other than fork and wait for the child to exit.
This commit is contained in:
@@ -83,22 +83,18 @@ class Foreman::CLI < Thor
|
|||||||
engine.load_procfile(procfile)
|
engine.load_procfile(procfile)
|
||||||
end
|
end
|
||||||
|
|
||||||
pid = fork do
|
begin
|
||||||
begin
|
engine.env.each { |k,v| ENV[k] = v }
|
||||||
engine.env.each { |k,v| ENV[k] = v }
|
if args.size == 1 && process = engine.process(args.first)
|
||||||
if args.size == 1 && process = engine.process(args.first)
|
process.exec(:env => engine.env)
|
||||||
process.exec(:env => engine.env)
|
else
|
||||||
else
|
exec args.shelljoin
|
||||||
exec args.shelljoin
|
|
||||||
end
|
|
||||||
rescue Errno::EACCES
|
|
||||||
error "not executable: #{args.first}"
|
|
||||||
rescue Errno::ENOENT
|
|
||||||
error "command not found: #{args.first}"
|
|
||||||
end
|
end
|
||||||
|
rescue Errno::EACCES
|
||||||
|
error "not executable: #{args.first}"
|
||||||
|
rescue Errno::ENOENT
|
||||||
|
error "command not found: #{args.first}"
|
||||||
end
|
end
|
||||||
Process.wait(pid)
|
|
||||||
exit $?.exitstatus
|
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "version", "Display Foreman gem version"
|
desc "version", "Display Foreman gem version"
|
||||||
|
|||||||
Reference in New Issue
Block a user