bin/mongrel_rails in mongrel-0.3.5 vs bin/mongrel_rails in mongrel-0.3.6
- old
+ new
@@ -1,8 +1,7 @@
require 'rubygems'
require 'mongrel'
-require 'daemons/daemonize'
require 'mongrel/command'
class RailsHandler < Mongrel::HttpHandler
@@ -75,11 +74,13 @@
return @valid
end
def daemonize
# save this for later since daemonize will hose it
- if @daemon
+ if @daemon and RUBY_PLATFORM !~ /mswin/
+ require 'daemons/daemonize'
+
puts "Started Mongrel server in #@environment mode at #@address:#@port"
Daemonize.daemonize(log_file=File.join(@cwd, @log_file))
# change back to the original starting directory
Dir.chdir(@cwd)
@@ -118,16 +119,18 @@
def start_mongrel(rails)
# start up mongrel with the right configurations
server = Mongrel::HttpServer.new(@address, @port, @num_procs.to_i, @timeout.to_i)
server.register("/", rails)
server.run
+ trap("INT") { server.stop }
begin
puts "Server ready."
server.acceptor.join
rescue Interrupt
puts "Interrupted."
+ raise
end
end
def run
daemonize
@@ -169,10 +172,8 @@
File.unlink(@pid_file)
puts "Done."
end
end
-
-
Mongrel::Command::Registry.instance.run ARGV