Commit da34e008 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #5294 from dalehamel/master

Ensure directory exists before changing in popen
parents 1080a9ba 6d7ced4a
require 'fileutils'
module Gitlab module Gitlab
module Popen module Popen
def popen(cmd, path) def popen(cmd, path)
vars = { "PWD" => path } vars = { "PWD" => path }
options = { chdir: path } options = { chdir: path }
unless File.directory?(path)
FileUtils.mkdir_p(path)
end
@cmd_output = "" @cmd_output = ""
@cmd_status = 0 @cmd_status = 0
Open3.popen3(vars, cmd, options) do |stdin, stdout, stderr, wait_thr| 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