-
Jonathan Hefner authored
Follow-up to #47208. `UnrecognizedCommandError` calls `printing_commands` to make "Did you mean?" suggestions. `printing_commands` calls `RakeCommand::rake_tasks`, which loads the Rake tasks if they have not been memoized. If the tasks have already been loaded by `RakeCommand::perform` (but not memoized by `RakeCommand::rake_tasks`), then the tasks will be loaded a second time. This can cause, for example, constant redefinition warnings if the task files define constants. Therefore, this commit memoizes the tasks from `RakeCommand::perform` before raising `UnrecognizedCommandError`.
Jonathan Hefner authoredFollow-up to #47208. `UnrecognizedCommandError` calls `printing_commands` to make "Did you mean?" suggestions. `printing_commands` calls `RakeCommand::rake_tasks`, which loads the Rake tasks if they have not been memoized. If the tasks have already been loaded by `RakeCommand::perform` (but not memoized by `RakeCommand::rake_tasks`), then the tasks will be loaded a second time. This can cause, for example, constant redefinition warnings if the task files define constants. Therefore, this commit memoizes the tasks from `RakeCommand::perform` before raising `UnrecognizedCommandError`.
Loading