Exception: Cheetah::ExecutionFailed

Inherits:
StandardError
  • Object
show all
Defined in:
lib/cheetah.rb

Overview

Exception raised when a command execution fails.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commands, status, stdout, stderr, message = nil) ⇒ ExecutionFailed

Initializes a new Cheetah::ExecutionFailed instance.

Parameters:

  • commands (Array<Array<String>>)

    the executed commands as an array where each item is again an array containing an executed command in the first element and its arguments in the remaining ones

  • status (Process::Status)

    the executed command exit status

  • stdout (String, nil)

    the output the executed command wrote to stdout

  • stderr (String, nil)

    the output the executed command wrote to stderr

  • message (String, nil) (defaults to: nil)

    the exception message



70
71
72
73
74
75
76
# File 'lib/cheetah.rb', line 70

def initialize(commands, status, stdout, stderr, message = nil)
  super(message)
  @commands = commands
  @status   = status
  @stdout   = stdout
  @stderr   = stderr
end

Instance Attribute Details

#commandsArray<Array<String>> (readonly)

Returns the executed commands as an array where each item is again an array containing an executed command in the first element and its arguments in the remaining ones.

Returns:

  • (Array<Array<String>>)

    the executed commands as an array where each item is again an array containing an executed command in the first element and its arguments in the remaining ones



48
49
50
# File 'lib/cheetah.rb', line 48

def commands
  @commands
end

#statusProcess::Status (readonly)

Returns the executed command exit status.

Returns:

  • (Process::Status)

    the executed command exit status



51
52
53
# File 'lib/cheetah.rb', line 51

def status
  @status
end

#stderrString? (readonly)

Returns the output the executed command wrote to stderr; can be ‘nil` if stderr was captured into a stream.

Returns:

  • (String, nil)

    the output the executed command wrote to stderr; can be ‘nil` if stderr was captured into a stream



59
60
61
# File 'lib/cheetah.rb', line 59

def stderr
  @stderr
end

#stdoutString? (readonly)

Returns the output the executed command wrote to stdout; can be ‘nil` if stdout was captured into a stream.

Returns:

  • (String, nil)

    the output the executed command wrote to stdout; can be ‘nil` if stdout was captured into a stream



55
56
57
# File 'lib/cheetah.rb', line 55

def stdout
  @stdout
end