diff options
author | Dale Hamel <dale.hamel@srvthe.net> | 2013-10-08 13:36:16 -0500 |
---|---|---|
committer | Dale Hamel <dale.hamel@invenia.ca> | 2013-10-08 13:50:46 -0500 |
commit | 1875141a963a4238bda29011d8f7105839485253 (patch) | |
tree | a5b91121df4e837241f4348e81a3fe5a29c9c392 /lib/gitlab/popen.rb | |
parent | 358426d66164d720d793ea37bacb4fc331c30171 (diff) | |
download | gitlab-ce-1875141a963a4238bda29011d8f7105839485253.tar.gz |
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.
Diffstat (limited to 'lib/gitlab/popen.rb')
-rw-r--r-- | lib/gitlab/popen.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb index 2f30fde2078..369d6cc1f5d 100644 --- a/lib/gitlab/popen.rb +++ b/lib/gitlab/popen.rb @@ -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| |