Class: Toys::Utils::Exec::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/toys/utils/exec.rb

Overview

The return result from a subcommand

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#captured_errString? (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_outString? (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

#statusProcess::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_codeInteger

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