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



68
69
70
71
72
73
74
# File 'lib/cheetah.rb', line 68

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



46
47
48
# File 'lib/cheetah.rb', line 46

def commands
  @commands
end

#statusProcess::Status (readonly)

Returns the executed command exit status.

Returns:

  • (Process::Status)

    the executed command exit status



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

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



57
58
59
# File 'lib/cheetah.rb', line 57

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



53
54
55
# File 'lib/cheetah.rb', line 53

def stdout
  @stdout
end