Skip to content

Commit

Permalink
Merge pull request #374 from puppetlabs/bug-add_sync_to_puppet-lint-init
Browse files Browse the repository at this point in the history
(bug) - Add synchronization to Dir.chdir in init_puppet_lint
  • Loading branch information
LukasAud authored Apr 17, 2024
2 parents 2a7db14 + fb4bc1d commit 1627acc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/puppet-languageserver/manifest/validation_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ def self.init_puppet_lint(root_dir, lint_options = [])
linter_options = PuppetLint::OptParser.build
else
begin
Dir.chdir(root_dir.to_s) { linter_options = PuppetLint::OptParser.build }
$PuppetParserMutex.synchronize do # rubocop:disable Style/GlobalVars
Dir.chdir(root_dir.to_s) { linter_options = PuppetLint::OptParser.build }
end
rescue OptionParser::InvalidOption => e
PuppetLanguageServer.log_message(:error, "(#{name}) Error reading Puppet Lint configuration. Using default: #{e}")
linter_options = PuppetLint::OptParser.build
Expand Down

0 comments on commit 1627acc

Please sign in to comment.