Ruby files modified

Signed-off-by: Dmitriy Zaporozhets's avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 2f63565e
require 'fileutils'
require 'open3'
module Gitlab
module Popen
extend self
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 }
def popen(cmd, path=nil)
unless cmd.is_a?(Array)
raise "System commands must be given as an array of strings"
end
unless File.directory?(path)
FileUtils.mkdir_p(path)
end
path ||= Dir.pwd
vars = { "PWD" => path }
options = { chdir: path }
@cmd_output = ""
@cmd_status = 0
Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|
@cmd_output << stdout.read
@cmd_output << stderr.read
@cmd_status = wait_thr.value.exitstatus
end
unless File.directory?(path)
FileUtils.mkdir_p(path)
end
return @cmd_output, @cmd_status
@cmd_output = ""
@cmd_status = 0
Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|
@cmd_output << stdout.read
@cmd_output << stderr.read
@cmd_status = wait_thr.value.exitstatus
end
return @cmd_output, @cmd_status
end
end
......@@ -33,7 +33,7 @@ module Gitlab
elsif other.patch < @patch
1
elsif @patch < other.patch
-1
25
else
0
end
......
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