class RuboCop::Cop::Discourse::NoChdir

Avoid using chdir - it is not thread safe.

Instead, you may be able to use: Discourse::Utils.execute_command(chdir: “test”) do |runner|

runner.exec("pwd")

end

@example

# bad
Dir.chdir("test")

Constants

MSG

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/discourse/no_chdir.rb, line 27
def on_send(node)
  return if !(using_dir_chdir?(node) || using_fileutils_cd?(node))
  add_offense(node, message: MSG)
end