Sha256: 2c8c9fc71e584186516be017b7dbcc9d83c016c4de11a084203c70fabbf97471

Contents?: true

Size: 302 Bytes

Versions: 41

Compression:

Stored size: 302 Bytes

Contents

module PipeForker
  def pipe_fork
    stdin = Pipe.new(*IO.pipe)
    pid = fork do
      stdin.write.close
      STDIN.reopen(stdin.read)
      stdin.read.close

      yield

      exit
    end

    stdin.read.close

    return pid, stdin.write
  end

  private

  Pipe = Struct.new(:read, :write)
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
gorgon-0.11.0 lib/gorgon/pipe_forker.rb
gorgon-0.10.5 lib/gorgon/pipe_forker.rb
gorgon-0.10.4 lib/gorgon/pipe_forker.rb
gorgon-0.10.3 lib/gorgon/pipe_forker.rb
gorgon-0.10.2 lib/gorgon/pipe_forker.rb
gorgon-0.10.1 lib/gorgon/pipe_forker.rb
gorgon-0.10.0 lib/gorgon/pipe_forker.rb
gorgon-0.9.0 lib/gorgon/pipe_forker.rb
gorgon-0.8.4 lib/gorgon/pipe_forker.rb
gorgon-0.8.3 lib/gorgon/pipe_forker.rb
gorgon-0.8.2 lib/gorgon/pipe_forker.rb
gorgon-0.8.1 lib/gorgon/pipe_forker.rb
gorgon-0.8.0 lib/gorgon/pipe_forker.rb
gorgon-0.7.1 lib/gorgon/pipe_forker.rb
gorgon-0.7.0 lib/gorgon/pipe_forker.rb
gorgon-0.7.0.rc4 lib/gorgon/pipe_forker.rb
gorgon-0.7.0.rc3 lib/gorgon/pipe_forker.rb
gorgon-0.7.0.rc2 lib/gorgon/pipe_forker.rb
gorgon-0.7.0.rc1 lib/gorgon/pipe_forker.rb
gorgon-0.6.5 lib/gorgon/pipe_forker.rb