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

Improved Windows platform detection

Usage of RbConfig::CONFIG['host_os'] instead of RUBY_PLATFORM.
This change improves JRuby support for Mongrel in general.
This commit is contained in:
Luis Lavena 2010-04-28 02:34:31 -03:00
parent c79c3b786a
commit c3d8b189d3
5 changed files with 7 additions and 6 deletions

View file

@ -5,6 +5,7 @@ Improvements:
* Ruby 1.9 early compatbility: Merged commits form Eric Wong and Matt Aimonetti. * Ruby 1.9 early compatbility: Merged commits form Eric Wong and Matt Aimonetti.
* Better RubyGems support thanks to added env she-bang to mongrel_rails executable. * Better RubyGems support thanks to added env she-bang to mongrel_rails executable.
* Smartly load http11 extension using fat-binary approach. * Smartly load http11 extension using fat-binary approach.
* Better detection of Windows platform (usage of RbConfig::CONFIG instead of RUBY_PLATFORM)
Bugfixes: Bugfixes:

View file

@ -138,7 +138,7 @@ module Mongrel
config.join config.join
if config.needs_restart if config.needs_restart
if RUBY_PLATFORM !~ /mswin/ unless RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
cmd = "ruby #{__FILE__} start #{original_args.join(' ')}" cmd = "ruby #{__FILE__} start #{original_args.join(' ')}"
config.log "Restarting with arguments: #{cmd}" config.log "Restarting with arguments: #{cmd}"
config.stop(false, true) config.stop(false, true)

View file

@ -81,7 +81,7 @@ module Mongrel
# Writes the PID file if we're not on Windows. # Writes the PID file if we're not on Windows.
def write_pid_file def write_pid_file
if RUBY_PLATFORM !~ /mingw|mswin/ unless RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
log "Writing PID file to #{@pid_file}" log "Writing PID file to #{@pid_file}"
open(@pid_file,"w") {|f| f.write(Process.pid) } open(@pid_file,"w") {|f| f.write(Process.pid) }
open(@pid_file,"w") do |f| open(@pid_file,"w") do |f|
@ -185,7 +185,7 @@ module Mongrel
def daemonize(options={}) def daemonize(options={})
ops = resolve_defaults(options) ops = resolve_defaults(options)
# save this for later since daemonize will hose it # save this for later since daemonize will hose it
if RUBY_PLATFORM !~ /mingw|mswin/ unless RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
require 'daemons/daemonize' require 'daemons/daemonize'
logfile = ops[:log_file] logfile = ops[:log_file]
@ -366,7 +366,7 @@ module Mongrel
# clean up the pid file always # clean up the pid file always
at_exit { remove_pid_file } at_exit { remove_pid_file }
if RUBY_PLATFORM !~ /mingw|mswin/ unless RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
# graceful shutdown # graceful shutdown
trap("TERM") { log "TERM signal received."; stop } trap("TERM") { log "TERM signal received."; stop }
trap("USR1") { log "USR1 received, toggling $mongrel_debug_client to #{!$mongrel_debug_client}"; $mongrel_debug_client = !$mongrel_debug_client } trap("USR1") { log "USR1 received, toggling $mongrel_debug_client to #{!$mongrel_debug_client}"; $mongrel_debug_client = !$mongrel_debug_client }

View file

@ -173,7 +173,7 @@ module Mongrel
ops = resolve_defaults(options) ops = resolve_defaults(options)
setup_signals(options) setup_signals(options)
if RUBY_PLATFORM !~ /mingw|mswin/ unless RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
# rails reload # rails reload
trap("HUP") { log "HUP signal received."; reload! } trap("HUP") { log "HUP signal received."; reload! }

View file

@ -67,5 +67,5 @@ end
# Platform check helper ;-) # Platform check helper ;-)
def windows? def windows?
result = RUBY_PLATFORM =~ /mingw|mswin/ @windows ||= RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
end end