Exception: Bsdkrun::CommandFailed

Inherits:
Error
  • Object
show all
Defined in:
lib/bsdkrun/errors.rb

Overview

A bsdkrun invocation exited non-zero.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exit_code:, stdout:, stderr:, command:) ⇒ CommandFailed

Returns a new instance of CommandFailed.

Parameters:

  • exit_code (Integer)
  • stdout (String)
  • stderr (String)
  • command (String)

    label describing the invocation.



33
34
35
36
37
38
39
40
41
42
# File 'lib/bsdkrun/errors.rb', line 33

def initialize(exit_code:, stdout:, stderr:, command:)
  @exit_code = exit_code
  @stdout = stdout
  @stderr = stderr
  @command = command
  message = "command failed (exit #{exit_code}): #{command}"
  trimmed = stderr.to_s.strip
  message += "\n#{trimmed}" unless trimmed.empty?
  super(message)
end

Instance Attribute Details

#commandString (readonly)

Returns a human label for the command that failed.

Returns:

  • (String)

    a human label for the command that failed.



27
28
29
# File 'lib/bsdkrun/errors.rb', line 27

def command
  @command
end

#exit_codeInteger (readonly)

Returns the process exit status.

Returns:

  • (Integer)

    the process exit status.



21
22
23
# File 'lib/bsdkrun/errors.rb', line 21

def exit_code
  @exit_code
end

#stderrString (readonly)

Returns the captured standard error.

Returns:

  • (String)

    the captured standard error.



25
26
27
# File 'lib/bsdkrun/errors.rb', line 25

def stderr
  @stderr
end

#stdoutString (readonly)

Returns the captured standard output.

Returns:

  • (String)

    the captured standard output.



23
24
25
# File 'lib/bsdkrun/errors.rb', line 23

def stdout
  @stdout
end