Skip to content

Commit 1d8e65a

Browse files
authored
Merge pull request rails#39137 from jonathanhefner/reentrant-rake_command-perform
Support reentrant calls to RakeCommand.perform
2 parents 3757222 + 68a3f67 commit 1d8e65a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

railties/lib/rails/commands/rake/rake_command.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ def printing_commands
1515
def perform(task, args, config)
1616
require_rake
1717

18-
ARGV.replace([task, *args]) # set up ARGV for Rake
19-
20-
Rake.application.standard_exception_handling do
21-
Rake.application.init("rails")
22-
Rake.application.load_rakefile
23-
Rake.application.top_level
18+
Rake.with_application do |rake|
19+
load "rails/tasks.rb"
20+
rake.init("rails", [task, *args])
21+
rake.load_rakefile
22+
rake.standard_exception_handling { rake.top_level }
2423
end
2524
end
2625

railties/lib/rails/tasks/statistics.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# While global constants are bad, many 3rd party tools depend on this one (e.g
44
# rspec-rails & cucumber-rails). So a deprecation warning is needed if we want
55
# to remove it.
6-
STATS_DIRECTORIES = [
6+
STATS_DIRECTORIES ||= [
77
%w(Controllers app/controllers),
88
%w(Helpers app/helpers),
99
%w(Jobs app/jobs),

0 commit comments

Comments
 (0)