Class: Toys::Utils::Exec::Result
- Inherits:
-
Object
- Object
- Toys::Utils::Exec::Result
- Defined in:
- lib/toys/utils/exec.rb
Overview
The result returned from a subcommand execution.
Instance Attribute Summary collapse
-
#captured_err ⇒ String?
readonly
The captured error string.
-
#captured_out ⇒ String?
readonly
The captured output string.
-
#exception ⇒ Exception?
readonly
The exception raised if a process couldn't be started.
-
#name ⇒ Object
readonly
The subcommand's name.
-
#status ⇒ Process::Status?
readonly
The status code object.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Returns true if the subprocess terminated with a nonzero status.
-
#exit_code ⇒ Integer
The numeric status code.
-
#success? ⇒ Boolean
Returns true if the subprocess terminated with a zero status.
Instance Attribute Details
#captured_err ⇒ String? (readonly)
The captured error string.
718 719 720 |
# File 'lib/toys/utils/exec.rb', line 718 def captured_err @captured_err end |
#captured_out ⇒ String? (readonly)
The captured output string.
710 711 712 |
# File 'lib/toys/utils/exec.rb', line 710 def captured_out @captured_out end |
#exception ⇒ Exception? (readonly)
The exception raised if a process couldn't be started.
Exactly one of exception and status will be non-nil.
738 739 740 |
# File 'lib/toys/utils/exec.rb', line 738 def exception @exception end |
#name ⇒ Object (readonly)
The subcommand's name.
702 703 704 |
# File 'lib/toys/utils/exec.rb', line 702 def name @name end |
#status ⇒ Process::Status? (readonly)
The status code object.
Exactly one of exception and status will be non-nil.
728 729 730 |
# File 'lib/toys/utils/exec.rb', line 728 def status @status end |
Instance Method Details
#error? ⇒ Boolean
Returns true if the subprocess terminated with a nonzero status.
766 767 768 |
# File 'lib/toys/utils/exec.rb', line 766 def error? !exit_code.zero? end |
#exit_code ⇒ Integer
The numeric status code.
This will be a nonzero integer if the process failed to start. That
is, exit_code will never be nil, even if status is nil.
748 749 750 |
# File 'lib/toys/utils/exec.rb', line 748 def exit_code status ? status.exitstatus : 127 end |
#success? ⇒ Boolean
Returns true if the subprocess terminated with a zero status.
757 758 759 |
# File 'lib/toys/utils/exec.rb', line 757 def success? exit_code.zero? end |