Class: WifiWand::CommandExecutor::OsCommandResult
- Inherits:
-
Object
- Object
- WifiWand::CommandExecutor::OsCommandResult
- Defined in:
- lib/wifi_wand/services/command_executor.rb
Instance Attribute Summary collapse
-
#combined_output ⇒ Object
readonly
Returns the value of attribute combined_output.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#exitstatus ⇒ Object
readonly
Returns the value of attribute exitstatus.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
-
#termsig ⇒ Object
readonly
Returns the value of attribute termsig.
Instance Method Summary collapse
-
#initialize(stdout:, stderr:, combined_output:, exitstatus:, command:, duration:, termsig: nil) ⇒ OsCommandResult
constructor
A new instance of OsCommandResult.
- #success? ⇒ Boolean
- #termination_status ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(stdout:, stderr:, combined_output:, exitstatus:, command:, duration:, termsig: nil) ⇒ OsCommandResult
Returns a new instance of OsCommandResult.
324 325 326 327 328 329 330 331 332 |
# File 'lib/wifi_wand/services/command_executor.rb', line 324 def initialize(stdout:, stderr:, combined_output:, exitstatus:, command:, duration:, termsig: nil) @stdout = stdout || '' @stderr = stderr || '' @combined_output = combined_output || '' @exitstatus = exitstatus @termsig = termsig @command = command @duration = duration end |
Instance Attribute Details
#combined_output ⇒ Object (readonly)
Returns the value of attribute combined_output.
322 323 324 |
# File 'lib/wifi_wand/services/command_executor.rb', line 322 def combined_output @combined_output end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
322 323 324 |
# File 'lib/wifi_wand/services/command_executor.rb', line 322 def command @command end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
322 323 324 |
# File 'lib/wifi_wand/services/command_executor.rb', line 322 def duration @duration end |
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
322 323 324 |
# File 'lib/wifi_wand/services/command_executor.rb', line 322 def exitstatus @exitstatus end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
322 323 324 |
# File 'lib/wifi_wand/services/command_executor.rb', line 322 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
322 323 324 |
# File 'lib/wifi_wand/services/command_executor.rb', line 322 def stdout @stdout end |
#termsig ⇒ Object (readonly)
Returns the value of attribute termsig.
322 323 324 |
# File 'lib/wifi_wand/services/command_executor.rb', line 322 def termsig @termsig end |
Instance Method Details
#success? ⇒ Boolean
334 |
# File 'lib/wifi_wand/services/command_executor.rb', line 334 def success? = termsig.nil? && exitstatus == 0 |
#termination_status ⇒ Object
338 339 340 341 342 343 344 |
# File 'lib/wifi_wand/services/command_executor.rb', line 338 def termination_status if termsig "Signal: #{signal_label(termsig)}" else "Exit code: #{exitstatus || 'unknown'}" end end |
#to_h ⇒ Object
346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/wifi_wand/services/command_executor.rb', line 346 def to_h data = { stdout: stdout, stderr: stderr, combined_output: combined_output, exitstatus: exitstatus, command: command, duration: duration, } data[:termsig] = termsig if termsig data end |
#to_s ⇒ Object
336 |
# File 'lib/wifi_wand/services/command_executor.rb', line 336 def to_s = combined_output |