Ensure directory exists before changing in popen
If the directory does not exist, we want to ensure that it does. Forking repos will fail in some situations because of this issue.
This commit is contained in:
parent
358426d661
commit
1875141a96
1 changed files with 7 additions and 0 deletions
|
@ -1,9 +1,16 @@
|
|||
|
||||
require 'fileutils'
|
||||
|
||||
module Gitlab
|
||||
module Popen
|
||||
def popen(cmd, path)
|
||||
vars = { "PWD" => path }
|
||||
options = { chdir: path }
|
||||
|
||||
unless File.directory?(path)
|
||||
FileUtils.mkdir_p(path)
|
||||
end
|
||||
|
||||
@cmd_output = ""
|
||||
@cmd_status = 0
|
||||
Open3.popen3(vars, cmd, options) do |stdin, stdout, stderr, wait_thr|
|
||||
|
|
Loading…
Reference in a new issue