Exception: WifiWand::CommandExecutor::OsCommandError
- Defined in:
- lib/wifi_wand/services/command_executor.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#exitstatus ⇒ Object
readonly
Returns the value of attribute exitstatus.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#termsig ⇒ Object
readonly
Returns the value of attribute termsig.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #display_message ⇒ Object
-
#initialize(result: nil, exitstatus: nil, termsig: nil, command: nil, text: nil) ⇒ OsCommandError
constructor
A new instance of OsCommandError.
- #to_h ⇒ Object
Methods inherited from Error
#append_help_hint?, #exception, #message_for_display
Constructor Details
#initialize(result: nil, exitstatus: nil, termsig: nil, command: nil, text: nil) ⇒ OsCommandError
Returns a new instance of OsCommandError.
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'lib/wifi_wand/services/command_executor.rb', line 370 def initialize(result: nil, exitstatus: nil, termsig: nil, command: nil, text: nil) @result = result || OsCommandResult.new( stdout: text, stderr: '', combined_output: text, exitstatus: exitstatus, termsig: termsig, command: command, duration: nil ) @exitstatus = @result.exitstatus @termsig = @result.termsig @command = @result.command @text = @result.combined_output super(@text) end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
368 369 370 |
# File 'lib/wifi_wand/services/command_executor.rb', line 368 def command @command end |
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
368 369 370 |
# File 'lib/wifi_wand/services/command_executor.rb', line 368 def exitstatus @exitstatus end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
368 369 370 |
# File 'lib/wifi_wand/services/command_executor.rb', line 368 def result @result end |
#termsig ⇒ Object (readonly)
Returns the value of attribute termsig.
368 369 370 |
# File 'lib/wifi_wand/services/command_executor.rb', line 368 def termsig @termsig end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
368 369 370 |
# File 'lib/wifi_wand/services/command_executor.rb', line 368 def text @text end |
Instance Method Details
#display_message ⇒ Object
388 389 390 391 392 393 394 |
# File 'lib/wifi_wand/services/command_executor.rb', line 388 def lines = [] lines << unless .empty? lines << "Command failed: #{command}" lines << result.termination_status lines.join("\n") end |
#to_h ⇒ Object
396 397 398 399 400 |
# File 'lib/wifi_wand/services/command_executor.rb', line 396 def to_h data = { exitstatus: exitstatus, command: command, text: text } data[:termsig] = termsig if termsig data end |