mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added socket cleanup for lighttpd, both before and after [DHH] Added automatic creation of tmp/ when running script/server [DHH] Added silence_stream that'll work on both STDERR or STDOUT or any other stream and deprecated silence_stderr in the process [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3761 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
c0fb67c0f8
commit
eb01d35109
5 changed files with 29 additions and 12 deletions
|
@ -21,20 +21,25 @@ module Kernel
|
||||||
$VERBOSE = old_verbose
|
$VERBOSE = old_verbose
|
||||||
end
|
end
|
||||||
|
|
||||||
# Silences stderr for the duration of the block.
|
# For compatibility
|
||||||
|
def silence_stderr #:nodoc:
|
||||||
|
silence_stream(STDERR) { yield }
|
||||||
|
end
|
||||||
|
|
||||||
|
# Silences any stream for the duration of the block.
|
||||||
#
|
#
|
||||||
# silence_stderr do
|
# silence_stream(STDOUT) do
|
||||||
# $stderr.puts 'This will never be seen'
|
# puts 'This will never be seen'
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# $stderr.puts 'But this will'
|
# puts 'But this will'
|
||||||
def silence_stderr
|
def silence_stream(stream)
|
||||||
old_stderr = STDERR.dup
|
old_stream = stream.dup
|
||||||
STDERR.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
|
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
|
||||||
STDERR.sync = true
|
stream.sync = true
|
||||||
yield
|
yield
|
||||||
ensure
|
ensure
|
||||||
STDERR.reopen(old_stderr)
|
stream.reopen(old_stream)
|
||||||
end
|
end
|
||||||
|
|
||||||
def suppress(*exception_classes)
|
def suppress(*exception_classes)
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Added socket cleanup for lighttpd, both before and after [DHH]
|
||||||
|
|
||||||
|
* Added automatic creation of tmp/ when running script/server [DHH]
|
||||||
|
|
||||||
|
* Added silence_stream that'll work on both STDERR or STDOUT or any other stream and deprecated silence_stderr in the process [DHH]
|
||||||
|
|
||||||
* Added reload! method to script/console to reload all models and others that include Reloadable without quitting the console #4056 [esad@esse.at]
|
* Added reload! method to script/console to reload all models and others that include Reloadable without quitting the console #4056 [esad@esse.at]
|
||||||
|
|
||||||
* Added that rake rails:freeze:edge will now just export all the contents of the frameworks instead of just lib, so stuff like rails:update:scripts, rails:update:javascripts, and script/server on lighttpd still just works #4047 [DHH]
|
* Added that rake rails:freeze:edge will now just export all the contents of the frameworks instead of just lib, so stuff like rails:update:scripts, rails:update:javascripts, and script/server on lighttpd still just works #4047 [DHH]
|
||||||
|
|
|
@ -25,4 +25,5 @@ else
|
||||||
puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
|
puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
silence_stderr { `rake tmp:create` }
|
||||||
require "commands/servers/#{server}"
|
require "commands/servers/#{server}"
|
|
@ -72,6 +72,7 @@ end
|
||||||
trap(:INT) { exit }
|
trap(:INT) { exit }
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
`rake tmp:sockets:clear` # Needed if lighttpd crashes or otherwise leaves FCGI sockets around
|
||||||
`lighttpd #{!detach ? "-D " : ""}-f #{config_file}`
|
`lighttpd #{!detach ? "-D " : ""}-f #{config_file}`
|
||||||
ensure
|
ensure
|
||||||
unless detach
|
unless detach
|
||||||
|
@ -79,7 +80,11 @@ ensure
|
||||||
puts 'Exiting'
|
puts 'Exiting'
|
||||||
|
|
||||||
# Ensure FCGI processes are reaped
|
# Ensure FCGI processes are reaped
|
||||||
|
silence_stream(STDOUT) do
|
||||||
ARGV.replace ['-a', 'kill']
|
ARGV.replace ['-a', 'kill']
|
||||||
require 'commands/process/reaper'
|
require 'commands/process/reaper'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
`rake tmp:sockets:clear` # Remove sockets on clean shutdown
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue