Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/popen.rb')
-rw-r--r--lib/gitlab/popen.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb
new file mode 100644
index 00000000000..f2cfd8073e3
--- /dev/null
+++ b/lib/gitlab/popen.rb
@@ -0,0 +1,18 @@
+module Gitlab
+ module Popen
+ def popen(cmd, path)
+ vars = { "PWD" => path }
+ options = { :chdir => path }
+
+ @cmd_output = ""
+ @cmd_status = 0
+ Open3.popen3(vars, cmd, options) do |stdin, stdout, stderr, wait_thr|
+ @cmd_status = wait_thr.value.exitstatus
+ @cmd_output << stdout.read
+ @cmd_output << stderr.read
+ end
+
+ return @cmd_output, @cmd_status
+ end
+ end
+end