diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-03-22 19:19:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-22 19:19:16 -0400 |
commit | 36334bf989a6a3e3b7254804d6c7f6227e2a98e9 (patch) | |
tree | baf3b878079ba3f0a16112ae483fb257b3216482 /railties/lib | |
parent | 5e3ddf628397b8f3e88d7c3114d060e06289ac4c (diff) | |
parent | 9bc6178e008714828969dcaf1cfde8f62dc9d41f (diff) | |
download | rails-36334bf989a6a3e3b7254804d6c7f6227e2a98e9.tar.gz rails-36334bf989a6a3e3b7254804d6c7f6227e2a98e9.tar.bz2 rails-36334bf989a6a3e3b7254804d6c7f6227e2a98e9.zip |
Merge pull request #28527 from rst/fix_runner_argv_28515
Correctly reset ARGV for "rails runner `CODE' arg arg arg..."
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/commands/runner/runner_command.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/railties/lib/rails/commands/runner/runner_command.rb b/railties/lib/rails/commands/runner/runner_command.rb index 056ad980b9..6864a9726b 100644 --- a/railties/lib/rails/commands/runner/runner_command.rb +++ b/railties/lib/rails/commands/runner/runner_command.rb @@ -16,7 +16,7 @@ module Rails "#{super} [<'Some.ruby(code)'> | <filename.rb>]" end - def perform(code_or_file = nil, *file_argv) + def perform(code_or_file = nil, *command_argv) unless code_or_file help exit 1 @@ -27,9 +27,10 @@ module Rails require_application_and_environment! Rails.application.load_runner + ARGV.replace(command_argv) + if File.exist?(code_or_file) $0 = code_or_file - ARGV.replace(file_argv) Kernel.load code_or_file else begin |