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.



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

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)


5
6
7
# File 'lib/common/exec/result.rb', line 5

def command
  @command
end

#exit_statusInteger (readonly)

exit status of the command

Returns:

  • (Integer)


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

def exit_status
  @exit_status
end

#outputString (readonly)

output from the executed command

Returns:

  • (String)


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

def output
  @output
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/common/exec/result.rb', line 24

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

#not_found?Boolean

true if the command was not found

Returns:

  • (Boolean)


29
30
31
# File 'lib/common/exec/result.rb', line 29

def not_found?
  @not_found
end

#success?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/common/exec/result.rb', line 20

def success?
  @exit_status == 0
end