diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-06 09:43:57 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-06 09:43:57 -0700 |
commit | 6acb858d06fa0873135eea0957a4aa5ea2fd0d2b (patch) | |
tree | 45d323bd1031481bfcf06e06797fef066c53f461 /railties/lib/rails/commands/runner.rb | |
parent | cae68d221cc81232e30049eafa4ff59b2c5f6010 (diff) | |
parent | cb2d811ebbf3c3c9941618813f73261b3449eecf (diff) | |
download | rails-6acb858d06fa0873135eea0957a4aa5ea2fd0d2b.tar.gz rails-6acb858d06fa0873135eea0957a4aa5ea2fd0d2b.tar.bz2 rails-6acb858d06fa0873135eea0957a4aa5ea2fd0d2b.zip |
Merge pull request #389 from jasonrudolph/always_flush_logger_at_exit
Always flush logger at exit
Diffstat (limited to 'railties/lib/rails/commands/runner.rb')
-rw-r--r-- | railties/lib/rails/commands/runner.rb | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb index 1a91d477ec..ddd08a32ee 100644 --- a/railties/lib/rails/commands/runner.rb +++ b/railties/lib/rails/commands/runner.rb @@ -39,18 +39,12 @@ ENV["RAILS_ENV"] = options[:environment] require APP_PATH Rails.application.require_environment! -begin - if code_or_file.nil? - $stderr.puts "Run '#{$0} -h' for help." - exit 1 - elsif File.exist?(code_or_file) - $0 = code_or_file - eval(File.read(code_or_file), nil, code_or_file) - else - eval(code_or_file) - end -ensure - if defined? Rails - Rails.logger.flush if Rails.logger.respond_to?(:flush) - end +if code_or_file.nil? + $stderr.puts "Run '#{$0} -h' for help." + exit 1 +elsif File.exist?(code_or_file) + $0 = code_or_file + eval(File.read(code_or_file), nil, code_or_file) +else + eval(code_or_file) end |