From d96c5a81af7f4416c6276b8517689a750b5e531f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 20 Apr 2014 08:57:08 -0700 Subject: [PATCH] core: Log around process locks --- lib/vagrant/environment.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 7c9600488..3a8509456 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -360,15 +360,19 @@ module Vagrant # The path to this lock lock_path = data_dir.join("lock.#{name}.lock") + @logger.debug("Attempting to acquire process-lock: #{name}") File.open(lock_path, "w+") do |f| # The file locking fails only if it returns "false." If it # succeeds it returns a 0, so we must explicitly check for # the proper error case. if f.flock(File::LOCK_EX | File::LOCK_NB) === false + @logger.warn("Process-lock in use: #{name}") raise Errors::EnvironmentLockedError, name: name end + @logger.info("Acquired process lock: #{name}") + begin # Mark that we have a lock @locks[name] = true