diff options
Diffstat (limited to 'lib/gitlab/popen.rb')
-rw-r--r-- | lib/gitlab/popen.rb | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb deleted file mode 100644 index 43e07e09160..00000000000 --- a/lib/gitlab/popen.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'fileutils' -require 'open3' - -module Gitlab - module Popen - extend self - - def popen(cmd, path=nil) - unless cmd.is_a?(Array) - raise "System commands must be given as an array of strings" - end - - path ||= Dir.pwd - 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| - # We are not using stdin so we should close it, in case the command we - # are running waits for input. - stdin.close - @cmd_output << stdout.read - @cmd_output << stderr.read - @cmd_status = wait_thr.value.exitstatus - end - - [@cmd_output, @cmd_status] - end - end -end |