Commit 1875141a authored by Dale Hamel's avatar Dale Hamel Committed by Dale Hamel

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.
parent 358426d6
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|
......
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