Class: EventMachine::POSIX::Spawn::Child::WritableStream

Inherits:
Stream
  • Object
show all
Defined in:
lib/em/posix/spawn/child.rb

Instance Attribute Summary

Attributes inherited from Stream

#buffer

Instance Method Summary collapse

Methods inherited from Stream

#close, #closed?, #force_encoding, #initialize

Constructor Details

This class inherits a constructor from EventMachine::POSIX::Spawn::Child::Stream

Instance Method Details

#notify_writableObject



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/em/posix/spawn/child.rb', line 467

def notify_writable
  # Close and detach are decoupled, check if this notification is
  # supposed to go through.
  return if closed?

  begin
    boom = nil
    size = @io.write_nonblock(@buffer)
    @buffer = @buffer[size, @buffer.size]
  rescue Errno::EPIPE => boom
  rescue Errno::EAGAIN, Errno::EINTR
  end
  if boom || @buffer.size == 0
    close
    set_deferred_success
  end
end