Class: Bosh::Exec::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/common/exec/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, output, exit_status, not_found = false) ⇒ Result

Returns a new instance of Result.



15
16
17
18
19
20
# File 'lib/common/exec/result.rb', line 15

def initialize(command, output, exit_status, not_found=false)
  @command = command
  @output = output
  @exit_status = exit_status
  @not_found = not_found
end

Instance Attribute Details

#commandString (readonly)

command that generated the result

Returns:

  • (String)


7
8
9
# File 'lib/common/exec/result.rb', line 7

def command
  @command
end

#exit_statusInteger (readonly)

exit status of the command

Returns:

  • (Integer)


13
14
15
# File 'lib/common/exec/result.rb', line 13

def exit_status
  @exit_status
end

#outputString (readonly)

output from the executed command

Returns:

  • (String)


10
11
12
# File 'lib/common/exec/result.rb', line 10

def output
  @output
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/common/exec/result.rb', line 26

def failed?
  @exit_status != 0 || @not_found
end

#not_found?Boolean

true if the command was not found

Returns:

  • (Boolean)


31
32
33
# File 'lib/common/exec/result.rb', line 31

def not_found?
  @not_found
end

#success?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/common/exec/result.rb', line 22

def success?
  @exit_status == 0
end