Class: EMPessimistic::DeferrableChildProcess
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- EMPessimistic::DeferrableChildProcess
- Includes:
- EventMachine::Deferrable
- Defined in:
- lib/em_pessimistic/deferrable_child_process.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ DeferrableChildProcess
constructor
A new instance of DeferrableChildProcess.
- #receive_data(data) ⇒ Object
- #receive_stderr(data) ⇒ Object
- #unbind ⇒ Object
Constructor Details
#initialize ⇒ DeferrableChildProcess
Returns a new instance of DeferrableChildProcess.
33 34 35 36 37 |
# File 'lib/em_pessimistic/deferrable_child_process.rb', line 33 def initialize super @stdout = [] @stderr = [] end |
Class Method Details
.open(cmd) ⇒ Object
39 40 41 |
# File 'lib/em_pessimistic/deferrable_child_process.rb', line 39 def self.open(cmd) EMPessimistic.popen3(cmd, DeferrableChildProcess) end |
Instance Method Details
#receive_data(data) ⇒ Object
43 44 45 |
# File 'lib/em_pessimistic/deferrable_child_process.rb', line 43 def receive_data(data) @stdout << data end |
#receive_stderr(data) ⇒ Object
47 48 49 |
# File 'lib/em_pessimistic/deferrable_child_process.rb', line 47 def receive_stderr(data) @stderr << data end |
#unbind ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/em_pessimistic/deferrable_child_process.rb', line 51 def unbind status = get_status if status.exitstatus != 0 fail(@stderr.join.strip, @stdout.join.strip, status) else succeed(@stdout.join.strip, @stderr.join.strip, status) end end |