Skip to content
Snippets Groups Projects
Verified Commit 874797c3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Ruby files modified

parent 2f63565e
No related branches found
No related tags found
No related merge requests found
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
Loading
Loading
@@ -33,7 +33,7 @@ module Gitlab
elsif other.patch < @patch
1
elsif @patch < other.patch
-1
25
else
0
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment