public
Description: A process execution library which doesn't suck.
Clone URL: git://github.com/codahale/ropen.git
Search Repo:
Added a per-stream accumulator.
codahale (author)
Thu May 15 16:26:26 -0700 2008
commit  89febc47ed1b69caa79de6ae1b4b780ad7304866
tree    a8c699eb283a44c6ab068b32340480096f082b1e
parent  d65e7a88207dce5a81c4536b822bacdfbbd8f683
...
4
5
6
7
 
8
9
10
 
11
12
13
...
18
19
20
 
21
22
23
...
4
5
6
 
7
8
9
10
11
12
13
14
...
19
20
21
22
23
24
25
0
@@ -4,10 +4,11 @@ require "ropen"
0
 # TODO: would halting the callback chain make any sense?
0
 
0
 class Ropen::Events
0
- attr_reader :callbacks
0
+ attr_reader :callbacks, :output
0
   
0
   def initialize
0
     @callbacks = []
0
+ @output = ""
0
   end
0
   
0
   def on_output(&block)
0
@@ -18,6 +19,7 @@ class Ropen::Events
0
     @thread = Thread.new do
0
       until stream.eof?
0
         data = stream.readpartial(1024)
0
+ @output << data
0
         @callbacks.each do |e|
0
           e.call(data)
0
         end
...
43
44
45
 
46
47
48
...
43
44
45
46
47
48
49
0
@@ -43,6 +43,7 @@ describe Ropen::Events do
0
     
0
     @events.run(@stream)
0
     @events.finish
0
+ @events.output.should == "blahblee"
0
     
0
     output.transpose.last.should == ["blah", "blah", "blee", "blee"]
0
   end

Comments

    No one has commented yet.