Class: PVC::OnlyErrPiece::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/pvc/only_err_piece.rb

Instance Method Summary collapse

Constructor Details

#initializeRunner

Returns a new instance of Runner.



5
6
7
8
9
10
11
12
# File 'lib/pvc/only_err_piece.rb', line 5

def initialize
  @stdread, @stdwrite = IO.pipe
  @errread, @errwrite = IO.pipe
  @stdread.close_on_exec = true
  @stdwrite.close_on_exec = true
  @errread.close_on_exec = true
  @errwrite.close_on_exec = true
end

Instance Method Details

#errinObject



18
19
20
# File 'lib/pvc/only_err_piece.rb', line 18

def errin
  @errwrite
end

#finishObject



28
29
30
31
32
33
34
# File 'lib/pvc/only_err_piece.rb', line 28

def finish
  @stdwrite.close
  @errwrite.close
  @errthread.join
  @stdread.close
  @errread.close
end

#start(following_piece) ⇒ Object



22
23
24
25
26
# File 'lib/pvc/only_err_piece.rb', line 22

def start(following_piece)
  @errthread = Thread.new do
    @errread.each_line { |line| following_piece.stdin.puts line }
  end
end

#stdinObject



14
15
16
# File 'lib/pvc/only_err_piece.rb', line 14

def stdin
  @stdwrite
end