mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:57:25 +08:00
DEV: Remove use of cd
in the app (#8337)
`FileUtils.cd` and `Dir.chdir` cause the working directory to change for the entire process. We run sidekiq jobs, hijacked requests and deferred jobs in threads, which can make working directory changes have unintended side-effects. - Add a rubocop rule to warn about usage of Dir.chdir and FileUtils.cd - Added rubocop:disable for scripts used outside the app - Refactored code using cd to use alternative methods - Temporarily skipped the rubocop check for lib/backup_restore. This will require more complex refactoring, so I will create a separate PR for review
This commit is contained in:
@ -42,7 +42,7 @@ class PluginTxUpdater
|
||||
PLUGINS.each do |plugin_name|
|
||||
plugin_dir = File.join(@base_dir, plugin_name)
|
||||
Bundler.with_clean_env do
|
||||
Dir.chdir(plugin_dir) do
|
||||
Dir.chdir(plugin_dir) do # rubocop:disable DiscourseCops/NoChdir because this is not part of the app
|
||||
puts '', plugin_dir, '-' * 80, ''
|
||||
|
||||
begin
|
||||
|
Reference in New Issue
Block a user