Sha256: 7ddf6adb7a9e7d17edfc764738e22a844a983499028dd1c77c07ea9514e53e7c

Contents?: true

Size: 447 Bytes

Versions: 4

Compression:

Stored size: 447 Bytes

Contents

require 'mock_world'
require 'mock_mros'

module Pmux
  class PipeIO
    def initialize cmd, mode='r'
      @io = IO.popen cmd, mode
      @on_receive = nil
      @close_flag = false
    end

    def flush_out_buffer
      data = @io.read 100
      if data
        on_read data
      else
        on_close unless @close_flag
        @close_flag = true
      end
    end

    def attach loop
      loop.world.push_connection self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pmux-0.1.3 test/mock_pipeio.rb
pmux-0.1.2 test/mock_pipeio.rb
pmux-0.1.1 test/mock_pipeio.rb
pmux-0.1.0 test/mock_pipeio.rb