Module: Gorgon::PipeForker

Included in:
WorkerManager
Defined in:
lib/gorgon/pipe_forker.rb

Defined Under Namespace

Classes: Pipe

Instance Method Summary collapse

Instance Method Details

#pipe_forkObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gorgon/pipe_forker.rb', line 3

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