Commit 7192f86ed0e2eec1bee94ee148253c1e65f925e3

Authored by Riyad Preukschas
1 parent 700a784b

Fix Satellite#lock

Showing 1 changed file with 6 additions and 2 deletions   Show diff stats
lib/gitlab/satellite/satellite.rb
@@ -25,14 +25,18 @@ module Gitlab @@ -25,14 +25,18 @@ module Gitlab
25 File.exists? path 25 File.exists? path
26 end 26 end
27 27
28 - # Locks the satellite and yields 28 + # * Locks the satellite
  29 + # * Changes the current directory to the satellite's working dir
  30 + # * Yields
29 def lock 31 def lock
30 raise "Satellite doesn't exist" unless exists? 32 raise "Satellite doesn't exist" unless exists?
31 33
32 File.open(lock_file, "w+") do |f| 34 File.open(lock_file, "w+") do |f|
33 f.flock(File::LOCK_EX) 35 f.flock(File::LOCK_EX)
34 36
35 - return yield 37 + Dir.chdir(path) do
  38 + return yield
  39 + end
36 end 40 end
37 end 41 end
38 42