diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-04 07:21:35 -0800 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-04 07:21:35 -0800 |
| commit | da34e008c3b67b4d06ecc8a06a102271157f3c13 (patch) | |
| tree | 4ed2aa2ab6c462d62a645dc291d8b7bb218ae786 | |
| parent | 1080a9babded36ec06342f5d7e34825c14992508 (diff) | |
| parent | 6d7ced4a2311eeff037c5575cca1868a6d3f586f (diff) | |
| download | gitlab-ce-da34e008c3b67b4d06ecc8a06a102271157f3c13.tar.gz | |
Merge pull request #5294 from dalehamel/master
Ensure directory exists before changing in popen
| -rw-r--r-- | lib/gitlab/popen.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb index 2f30fde2078..5283cf0b821 100644 --- a/lib/gitlab/popen.rb +++ b/lib/gitlab/popen.rb @@ -1,9 +1,15 @@ +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| |
