From 1875141a963a4238bda29011d8f7105839485253 Mon Sep 17 00:00:00 2001 From: Dale Hamel Date: Tue, 8 Oct 2013 13:36:16 -0500 Subject: [PATCH] Ensure directory exists before changing in popen --- lib/gitlab/popen.rb | 7 +++++++ 1 file changed, 7 insertions(+), 0 deletions(-) diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb index 2f30fde..369d6cc 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| -- libgit2 0.21.2