Merge pull request #125 from brainopia/master

Support for complex cmds in Procfile
This commit is contained in:
David Dollar
2012-01-12 15:23:15 -08:00
3 changed files with 11 additions and 3 deletions

View File

@@ -1,2 +1,2 @@
#!/bin/sh
exec $1 2>&1
#!/usr/bin/env ruby
exec "#{ARGV.join(' ')} 2>&1"

View File

@@ -72,10 +72,16 @@ private ######################################################################
def kill_all(signal="SIGTERM")
running_processes.each do |pid, process|
info "sending #{signal} to pid #{pid}"
Process.kill(signal, pid) rescue Errno::ESRCH
kill(signal, -pid) or kill(signal, pid)
end
end
def kill(signal, pid)
Process.kill signal, pid
rescue Errno::ESRCH
false
end
def terminate_gracefully
info "sending SIGTERM to all processes"
kill_all "SIGTERM"

View File

@@ -30,11 +30,13 @@ private
def fork_with_io(command)
reader, writer = IO.pipe
pid = fork do
Process.setpgrp
trap("INT", "IGNORE")
$stdout.reopen writer
reader.close
exec Foreman.runner, replace_command_env(command)
end
Process.detach pid
[ reader, pid ]
end