class R10K::Util::Subprocess::Result
@api private
Attributes
argv[R]
@!attribute [r] argv
@return [Array<String>]
cmd[R]
@!attribute [r] cmd
@return [String]
exit_code[R]
@!attribute [r] #exit_code
@return [Integer]
stderr[R]
@!attribute [r] stderr
@return [String]
stdout[R]
@!attribute [r] stdout
@return [String]
Public Class Methods
new(argv, stdout, stderr, exit_code)
click to toggle source
# File lib/r10k/util/subprocess/result.rb, line 24 def initialize(argv, stdout, stderr, exit_code) @argv = argv @cmd = argv.join(' ') @stdout = stdout.chomp @stderr = stderr.chomp @exit_code = exit_code end
Public Instance Methods
failed?()
click to toggle source
# File lib/r10k/util/subprocess/result.rb, line 49 def failed? exit_code != 0 end
format(with_cmd = true)
click to toggle source
# File lib/r10k/util/subprocess/result.rb, line 32 def format(with_cmd = true) msg = [] if with_cmd msg << "Command: #{@cmd}" end if !@stdout.empty? msg << "Stdout:" msg << @stdout end if !@stderr.empty? msg << "Stderr:" msg << @stderr end msg << "Exit code: #{@exit_code}" msg.join("\n") end
success?()
click to toggle source
# File lib/r10k/util/subprocess/result.rb, line 53 def success? exit_code == 0 end