Class: RightScale::RightPopen::ProcessStatus
- Inherits:
-
Object
- Object
- RightScale::RightPopen::ProcessStatus
- Defined in:
- lib/right_popen/process_status.rb
Overview
Quacks like Process::Status, which we cannot instantiate ourselves because has no public new method for cases where we need to create our own.
Instance Attribute Summary collapse
-
#exitstatus ⇒ Object
readonly
Returns the value of attribute exitstatus.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#termsig ⇒ Object
readonly
Returns the value of attribute termsig.
Instance Method Summary collapse
-
#exited? ⇒ TrueClass
Simulates Process::Status.exited? which seems like a weird method since this object cannot logically be queried until the process exits.
-
#initialize(pid, exitstatus, termsig = nil) ⇒ ProcessStatus
constructor
Parameters.
-
#success? ⇒ Boolean
Simulates Process::Status.success?.
Constructor Details
#initialize(pid, exitstatus, termsig = nil) ⇒ ProcessStatus
Parameters
41 42 43 44 45 |
# File 'lib/right_popen/process_status.rb', line 41 def initialize(pid, exitstatus, termsig=nil) @pid = pid @exitstatus = exitstatus @termsig = termsig end |
Instance Attribute Details
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
35 36 37 |
# File 'lib/right_popen/process_status.rb', line 35 def exitstatus @exitstatus end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
35 36 37 |
# File 'lib/right_popen/process_status.rb', line 35 def pid @pid end |
#termsig ⇒ Object (readonly)
Returns the value of attribute termsig.
35 36 37 |
# File 'lib/right_popen/process_status.rb', line 35 def termsig @termsig end |
Instance Method Details
#exited? ⇒ TrueClass
Simulates Process::Status.exited? which seems like a weird method since this object cannot logically be queried until the process exits.
Returns
52 53 54 |
# File 'lib/right_popen/process_status.rb', line 52 def exited? return true end |
#success? ⇒ Boolean
Simulates Process::Status.success?
Returns
true if the process returned zero as its exit code or nil if terminate was signalled
60 61 62 63 64 |
# File 'lib/right_popen/process_status.rb', line 60 def success? # note that Linux ruby returns nil when exitstatus is nil and a termsig # value is set instead. return @exitstatus ? (0 == @exitstatus) : nil end |