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.
809 810 811 |
# File 'lib/toys/utils/exec.rb', line 809 def captured_err @captured_err end |
#captured_out ⇒ String? (readonly)
The captured output string.
801 802 803 |
# File 'lib/toys/utils/exec.rb', line 801 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.
829 830 831 |
# File 'lib/toys/utils/exec.rb', line 829 def exception @exception end |
#name ⇒ Object (readonly)
The subcommand's name.
793 794 795 |
# File 'lib/toys/utils/exec.rb', line 793 def name @name end |
#status ⇒ Process::Status? (readonly)
The status code object.
Exactly one of exception and status will be non-nil.
819 820 821 |
# File 'lib/toys/utils/exec.rb', line 819 def status @status end |
Instance Method Details
#error? ⇒ Boolean
Returns true if the subprocess terminated with a nonzero status.
857 858 859 |
# File 'lib/toys/utils/exec.rb', line 857 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.
839 840 841 |
# File 'lib/toys/utils/exec.rb', line 839 def exit_code status ? status.exitstatus : 127 end |
#success? ⇒ Boolean
Returns true if the subprocess terminated with a zero status.
848 849 850 |
# File 'lib/toys/utils/exec.rb', line 848 def success? exit_code.zero? end |