Ignore failure when trying to delete lock file.

Deleting the lock file can fail when another process is currently trying to acquire it (-> race condition).
It is safe to ignore this error since the other process will eventually acquire the lock and again try to delete the lock file.
This commit is contained in:
Manuel Pöter 2015-06-03 13:27:03 +02:00
parent c20624bfdc
commit c3151c0b88
1 changed files with 5 additions and 1 deletions

View File

@ -484,7 +484,11 @@ module Vagrant
if name != "dotlock" if name != "dotlock"
lock("dotlock", retry: true) do lock("dotlock", retry: true) do
f.close f.close
File.delete(lock_path) begin
File.delete(lock_path)
rescue
@logger.debug("Failed to delete lock file #{lock_path} - some other thread might be trying to acquire it -> ignoring this error")
end
end end
end end