Commit 7192f86e authored by Riyad Preukschas's avatar Riyad Preukschas

Fix Satellite#lock

parent 700a784b
...@@ -25,16 +25,20 @@ module Gitlab ...@@ -25,16 +25,20 @@ module Gitlab
File.exists? path File.exists? path
end end
# Locks the satellite and yields # * Locks the satellite
# * Changes the current directory to the satellite's working dir
# * Yields
def lock def lock
raise "Satellite doesn't exist" unless exists? raise "Satellite doesn't exist" unless exists?
File.open(lock_file, "w+") do |f| File.open(lock_file, "w+") do |f|
f.flock(File::LOCK_EX) f.flock(File::LOCK_EX)
Dir.chdir(path) do
return yield return yield
end end
end end
end
def lock_file def lock_file
Rails.root.join("tmp", "#{project.path}.lock") Rails.root.join("tmp", "#{project.path}.lock")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment