summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-03-28 19:48:09 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-03-29 19:40:32 +0800
commit9d9ee76197818486d3cd5a178af4b28ba8b4fc31 (patch)
tree7ea42602c23dc09b320b1d0d1e6a96423cc1ddc2
parent4e712f766fb893705816fe199b1225460dd451b2 (diff)
downloadgitlab-ce-9d9ee76197818486d3cd5a178af4b28ba8b4fc31.tar.gz
Use Service::Shellout.shell to spawn a command
-rw-r--r--qa/qa/runtime/key/base.rb7
-rw-r--r--qa/qa/service/shellout.rb4
2 files changed, 4 insertions, 7 deletions
diff --git a/qa/qa/runtime/key/base.rb b/qa/qa/runtime/key/base.rb
index 0f74d314c56..c7e5ebada7b 100644
--- a/qa/qa/runtime/key/base.rb
+++ b/qa/qa/runtime/key/base.rb
@@ -21,12 +21,7 @@ module QA
def ssh_keygen(name, bits, path)
cmd = %W[ssh-keygen -t #{name} -b #{bits} -f #{path} -N] << ''
- IO.popen([*cmd, err: %i[child out]]) do |io|
- out = io.read
- io.close
-
- raise "ssh-keygen failed with output: #{out}" unless $?.success?
- end
+ Service::Shellout.shell(cmd)
end
def populate_key_data(path)
diff --git a/qa/qa/service/shellout.rb b/qa/qa/service/shellout.rb
index 76fb2af6319..1ca9504bb33 100644
--- a/qa/qa/service/shellout.rb
+++ b/qa/qa/service/shellout.rb
@@ -5,6 +5,8 @@ module QA
module Shellout
CommandError = Class.new(StandardError)
+ module_function
+
##
# TODO, make it possible to use generic QA framework classes
# as a library - gitlab-org/gitlab-qa#94
@@ -12,7 +14,7 @@ module QA
def shell(command)
puts "Executing `#{command}`"
- Open3.popen2e(command) do |_in, out, wait|
+ Open3.popen2e(*command) do |_in, out, wait|
out.each { |line| puts line }
if wait.value.exited? && wait.value.exitstatus.nonzero?