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
path: root/qa
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-03-28 14:48:09 +0300
committerLin Jen-Shin <godfat@godfat.org>2018-03-29 14:40:32 +0300
commit9d9ee76197818486d3cd5a178af4b28ba8b4fc31 (patch)
tree7ea42602c23dc09b320b1d0d1e6a96423cc1ddc2 /qa
parent4e712f766fb893705816fe199b1225460dd451b2 (diff)
Use Service::Shellout.shell to spawn a command
Diffstat (limited to 'qa')
-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?