Skip to content

Commit 1627acc

Browse files
authored
Merge pull request #374 from puppetlabs/bug-add_sync_to_puppet-lint-init
(bug) - Add synchronization to Dir.chdir in init_puppet_lint
2 parents 2a7db14 + fb4bc1d commit 1627acc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/puppet-languageserver/manifest/validation_provider.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ def self.init_puppet_lint(root_dir, lint_options = [])
109109
linter_options = PuppetLint::OptParser.build
110110
else
111111
begin
112-
Dir.chdir(root_dir.to_s) { linter_options = PuppetLint::OptParser.build }
112+
$PuppetParserMutex.synchronize do # rubocop:disable Style/GlobalVars
113+
Dir.chdir(root_dir.to_s) { linter_options = PuppetLint::OptParser.build }
114+
end
113115
rescue OptionParser::InvalidOption => e
114116
PuppetLanguageServer.log_message(:error, "(#{name}) Error reading Puppet Lint configuration. Using default: #{e}")
115117
linter_options = PuppetLint::OptParser.build

0 commit comments

Comments
 (0)