1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Fixes a bug on OSX by changing from exec to system on restart.

git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@352 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
zedshaw 2006-09-26 04:51:02 +00:00
parent 583294985f
commit bd5e634788
2 changed files with 14 additions and 2 deletions

View file

@ -139,7 +139,15 @@ module Mongrel
if RUBY_PLATFORM !~ /mswin/
cmd = "ruby #{__FILE__} start #{original_args.join(' ')}"
config.log "Restarting with arguments: #{cmd}"
exec cmd
config.stop
config.remove_pid_file
if config.defaults[:daemon]
system cmd
else
STDERR.puts "Can't restart unless in daemon mode."
exit 1
end
else
config.log "Win32 does not support restarts. Exiting."
end

View file

@ -70,6 +70,10 @@ module Mongrel
end
end
def remove_pid_file
File.unlink(@pid_file) if @pid_file and File.exists?(@pid_file)
end
# Writes the PID file but only if we're on windows.
def write_pid_file
if RUBY_PLATFORM !~ /mswin/
@ -350,7 +354,7 @@ module Mongrel
trap("INT") { log "INT signal received."; stop(false) }
# clean up the pid file always
at_exit { File.unlink(@pid_file) if @pid_file and File.exists?(@pid_file) }
at_exit { remove_pid_file }
if RUBY_PLATFORM !~ /mswin/
# graceful shutdown