Exception: Cuken::Api::Chef::Knife::CommandFailed
- Inherits:
-
StandardError
- Object
- StandardError
- Cuken::Api::Chef::Knife::CommandFailed
- Defined in:
- lib/cuken/api/chef/knife.rb
Overview
Raised when a command exits with non-zero.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
The full command that failed as a String.
-
#err ⇒ Object
readonly
Everything output on the command’s stderr as a String.
-
#exitstatus ⇒ Object
readonly
The integer exit status.
Instance Method Summary collapse
-
#initialize(command, exitstatus = nil, err = '') ⇒ CommandFailed
constructor
A new instance of CommandFailed.
Constructor Details
#initialize(command, exitstatus = nil, err = '') ⇒ CommandFailed
Returns a new instance of CommandFailed.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/cuken/api/chef/knife.rb', line 53 def initialize(command, exitstatus=nil, err='') if exitstatus @command = command @exitstatus = exitstatus @err = err = "Command failed [#{exitstatus}]: #{command}" << "\n\n" << err unless err.nil? || err.empty? super else super command end end |
Instance Attribute Details
#command ⇒ Object (readonly)
The full command that failed as a String.
45 46 47 |
# File 'lib/cuken/api/chef/knife.rb', line 45 def command @command end |
#err ⇒ Object (readonly)
Everything output on the command’s stderr as a String.
51 52 53 |
# File 'lib/cuken/api/chef/knife.rb', line 51 def err @err end |
#exitstatus ⇒ Object (readonly)
The integer exit status.
48 49 50 |
# File 'lib/cuken/api/chef/knife.rb', line 48 def exitstatus @exitstatus end |