Sha256: c74eb6c48c6769d13767098445454dba2a23dd7a8a3726cdab1bde8376d895ae
Contents?: true
Size: 983 Bytes
Versions: 17
Compression:
Stored size: 983 Bytes
Contents
require 'open3' module Gitlab module QA module Docker class Shellout StatusError = Class.new(StandardError) def initialize(command) @command = command @output = [] puts "Docker shell command: `#{@command.mask_secrets}`" end def execute! # rubocop:disable Metrics/AbcSize raise StatusError, 'Command already executed' if @output.any? Open3.popen2e(@command.to_s) do |_in, out, wait| out.each do |line| @output.push(line) if block_given? yield line, wait else puts line end end if wait.value.exited? && wait.value.exitstatus.nonzero? # rubocop:disable Style/IfUnlessModifier raise StatusError, "Docker command `#{@command.mask_secrets}` failed!" end end @output.join.chomp end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems