Class: PVC::ResultPiece::Runner
- Inherits:
-
Object
- Object
- PVC::ResultPiece::Runner
- Defined in:
- lib/pvc/result_piece.rb
Instance Method Summary collapse
- #errin ⇒ Object
- #finish ⇒ Object
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #start(following = nil) ⇒ Object
- #stdboth ⇒ Object
- #stderr ⇒ Object
- #stdin ⇒ Object
- #stdout ⇒ Object
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/pvc/result_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 @stdout = [] @stderr = [] @stdboth = [] end |
Instance Method Details
#errin ⇒ Object
21 22 23 |
# File 'lib/pvc/result_piece.rb', line 21 def errin @errwrite end |
#finish ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/pvc/result_piece.rb', line 40 def finish @stdwrite.close @errwrite.close @stdthread.join @errthread.join @stdread.close @errread.close end |
#start(following = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pvc/result_piece.rb', line 25 def start(following=nil) @stdthread = Thread.new do @stdread.each_line do |line| @stdout << line @stdboth << line end end @errthread = Thread.new do @errread.each_line do |line| @stderr << line @stdboth << line end end end |
#stdboth ⇒ Object
57 58 59 |
# File 'lib/pvc/result_piece.rb', line 57 def stdboth @stdboth.join("") end |
#stderr ⇒ Object
53 54 55 |
# File 'lib/pvc/result_piece.rb', line 53 def stderr @stderr.join("") end |
#stdin ⇒ Object
17 18 19 |
# File 'lib/pvc/result_piece.rb', line 17 def stdin @stdwrite end |
#stdout ⇒ Object
49 50 51 |
# File 'lib/pvc/result_piece.rb', line 49 def stdout @stdout.join("") end |