aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/commands
diff options
context:
space:
mode:
authorCyril Mougel <cyril.mougel@jtek.fr>2008-11-22 13:32:36 -0600
committerJoshua Peek <josh@joshpeek.com>2008-11-22 13:32:36 -0600
commit2144c0f8ff9bdd3dceb085ddb1c4b8711ef329a4 (patch)
tree7fb6098cb5f622bec1f8c3431d5d8a20737c32d9 /railties/lib/commands
parent20d6fdd2567b44fc7de9768a6dedd50d2ea9c4ce (diff)
downloadrails-2144c0f8ff9bdd3dceb085ddb1c4b8711ef329a4.tar.gz
rails-2144c0f8ff9bdd3dceb085ddb1c4b8711ef329a4.tar.bz2
rails-2144c0f8ff9bdd3dceb085ddb1c4b8711ef329a4.zip
Add flush by ensure in script/runner because no flush in production mode [#803 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'railties/lib/commands')
-rw-r--r--railties/lib/commands/runner.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/railties/lib/commands/runner.rb b/railties/lib/commands/runner.rb
index 14159c3893..2411c3d270 100644
--- a/railties/lib/commands/runner.rb
+++ b/railties/lib/commands/runner.rb
@@ -38,11 +38,15 @@ RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)
require RAILS_ROOT + '/config/environment'
-if code_or_file.nil?
- $stderr.puts "Run '#{$0} -h' for help."
- exit 1
-elsif File.exist?(code_or_file)
- eval(File.read(code_or_file), nil, code_or_file)
-else
- eval(code_or_file)
+begin
+ if code_or_file.nil?
+ $stderr.puts "Run '#{$0} -h' for help."
+ exit 1
+ elsif File.exist?(code_or_file)
+ eval(File.read(code_or_file), nil, code_or_file)
+ else
+ eval(code_or_file)
+ end
+ensure
+ RAILS_DEFAULT_LOGGER.flush if RAILS_DEFAULT_LOGGER
end