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

Bug 4414 fixed, should no longer clobber pid file

git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@205 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
zedshaw 2006-05-23 03:42:37 +00:00
parent 3843f96fb4
commit 4905d82fc0
3 changed files with 13 additions and 9 deletions

View file

@ -143,6 +143,7 @@ class Start < GemPlugin::Plugin "/commands"
config.run
config.log "Mongrel available at #{settings[:host]}:#{settings[:port]}"
config.log "Use CTRL-C to stop." if not @daemon
config.write_pid_file
config.join
if config.needs_restart

View file

@ -699,6 +699,8 @@ module Mongrel
# A major thing about Configurator is that it actually lets you configure
# multiple listeners for any hosts and ports you want. These are kept in a
# map config.listeners so you can get to them.
#
# * :pid_file => Where to write the process ID.
class Configurator
attr_reader :listeners
attr_reader :defaults
@ -731,6 +733,13 @@ module Mongrel
end
end
# Writes the PID file but only if we're on windows.
def write_pid_file
if RUBY_PLATFORM !~ /mswin/
open(@pid_file,"w") {|f| f.write(Process.pid) }
end
end
# generates a class for cloaking the current self and making the DSL nicer
def cloaking_class
class << self
@ -811,7 +820,6 @@ module Mongrel
#
# * :cwd => Directory to change to.
# * :log_file => Where to write STDOUT and STDERR.
# * :pid_file => Where to write the process ID.
#
# It is safe to call this on win32 as it will only require the daemons
# gem/library if NOT win32.
@ -826,7 +834,6 @@ module Mongrel
# change back to the original starting directory
Dir.chdir(ops[:cwd])
open(ops[:pid_file],"w") {|f| f.write(Process.pid) }
else
log "WARNING: Win32 does not support daemon mode."
end
@ -966,7 +973,7 @@ module Mongrel
# It only configures if the platform is not win32 and doesn't do
# a HUP signal since this is typically framework specific.
#
# Requires a :pid_file option to indicate a file to delete.
# Requires a :pid_file option given to Configurator.new to indicate a file to delete.
# It sets the MongrelConfig.needs_restart attribute if
# the start command should reload. It's up to you to detect this
# and do whatever is needed for a "restart".
@ -975,8 +982,6 @@ module Mongrel
def setup_signals(options={})
ops = resolve_defaults(options)
@pid_file = ops[:pid_file]
# forced shutdown, even if previously restarted (actually just like TERM but for CTRL-C)
trap("INT") { log "INT signal received."; stop(need_restart=false) }

View file

@ -21,8 +21,6 @@ require 'cgi'
module Mongrel
module Rails
# Implements a handler that can run Rails and serve files out of the
# Rails application's public directory. This lets you run your Rails
# application with Mongrel during development and testing, then use it
@ -65,7 +63,7 @@ module Mongrel
return if response.socket.closed?
path_info = request.params[Mongrel::Const::PATH_INFO]
page_cached = request.params[Mongrel::Const::PATH_INFO] + ".html"
page_cached = path_info + ".html"
if @files.can_serve(path_info)
# File exists as-is so serve it up