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 25 File.exists? path
26 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 31 def lock
30 32 raise "Satellite doesn't exist" unless exists?
31 33  
32 34 File.open(lock_file, "w+") do |f|
33 35 f.flock(File::LOCK_EX)
34 36  
35   - return yield
  37 + Dir.chdir(path) do
  38 + return yield
  39 + end
36 40 end
37 41 end
38 42  
... ...