Class: Toys::Utils::Exec::Result
- Inherits:
-
Object
- Object
- Toys::Utils::Exec::Result
- Defined in:
- lib/toys/utils/exec.rb
Overview
The return result from a subcommand
Instance Attribute Summary collapse
-
#captured_err ⇒ String?
readonly
Returns the captured error string, if the command was configured with
err: :capture. -
#captured_out ⇒ String?
readonly
Returns the captured output string, if the command was configured with
out: :capture. -
#status ⇒ Process::Status
readonly
Returns the status code object.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Returns true if the subprocess terminated with a nonzero status.
-
#exit_code ⇒ Integer
Returns the numeric status code.
-
#success? ⇒ Boolean
Returns true if the subprocess terminated with a zero status.
Instance Attribute Details
#captured_err ⇒ String? (readonly)
Returns the captured error string, if the command was configured
with err: :capture. Returns nil otherwise.
662 663 664 |
# File 'lib/toys/utils/exec.rb', line 662 def captured_err @captured_err end |
#captured_out ⇒ String? (readonly)
Returns the captured output string, if the command was configured
with out: :capture. Returns nil otherwise.
655 656 657 |
# File 'lib/toys/utils/exec.rb', line 655 def captured_out @captured_out end |
#status ⇒ Process::Status (readonly)
Returns the status code object.
668 669 670 |
# File 'lib/toys/utils/exec.rb', line 668 def status @status end |
Instance Method Details
#error? ⇒ Boolean
Returns true if the subprocess terminated with a nonzero status.
690 691 692 |
# File 'lib/toys/utils/exec.rb', line 690 def error? !exit_code.zero? end |
#exit_code ⇒ Integer
Returns the numeric status code.
674 675 676 |
# File 'lib/toys/utils/exec.rb', line 674 def exit_code status.exitstatus end |
#success? ⇒ Boolean
Returns true if the subprocess terminated with a zero status.
682 683 684 |
# File 'lib/toys/utils/exec.rb', line 682 def success? exit_code.zero? end |