1
0
Fork 0
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:
David Heinemeier Hansson 2006-03-04 19:39:26 +00:00
parent c0fb67c0f8
commit eb01d35109
5 changed files with 29 additions and 12 deletions

View file

@ -21,20 +21,25 @@ module Kernel
$VERBOSE = old_verbose
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
# $stderr.puts 'This will never be seen'
# silence_stream(STDOUT) do
# puts 'This will never be seen'
# end
#
# $stderr.puts 'But this will'
def silence_stderr
old_stderr = STDERR.dup
STDERR.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
STDERR.sync = true
# puts 'But this will'
def silence_stream(stream)
old_stream = stream.dup
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
stream.sync = true
yield
ensure
STDERR.reopen(old_stderr)
stream.reopen(old_stream)
end
def suppress(*exception_classes)

View file

@ -1,5 +1,11 @@
*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 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]

View file

@ -127,4 +127,4 @@ ARGV.options do |opts|
opts.parse!
end
ProgramProcess.process_keywords(OPTIONS[:action], OPTIONS[:dispatcher])
ProgramProcess.process_keywords(OPTIONS[:action], OPTIONS[:dispatcher])

View file

@ -25,4 +25,5 @@ else
puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
end
silence_stderr { `rake tmp:create` }
require "commands/servers/#{server}"

View file

@ -72,6 +72,7 @@ end
trap(:INT) { exit }
begin
`rake tmp:sockets:clear` # Needed if lighttpd crashes or otherwise leaves FCGI sockets around
`lighttpd #{!detach ? "-D " : ""}-f #{config_file}`
ensure
unless detach
@ -79,7 +80,11 @@ ensure
puts 'Exiting'
# Ensure FCGI processes are reaped
ARGV.replace ['-a', 'kill']
require 'commands/process/reaper'
silence_stream(STDOUT) do
ARGV.replace ['-a', 'kill']
require 'commands/process/reaper'
end
`rake tmp:sockets:clear` # Remove sockets on clean shutdown
end
end