Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Fix Ropen::Events::EventHandler to pass the Ropen::Commend to #start …
Browse files Browse the repository at this point in the history
…and #finish callbacks.
  • Loading branch information
codahale committed May 20, 2008
1 parent 58e832e commit d8b2018
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/ropen/events/event_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ def register(event)
end

def run(stdout, stderr)
call_events(:start)
call_events(:start, @command)
handle_output(stdout, :stdout)
handle_output(stderr, :stderr)
end

# Blocks until the threads started by #run completes.
def finish
@threads.each { |t| t.join }
call_events(:finish)
call_events(:finish, @command)
@threads.clear
end

Expand Down
4 changes: 2 additions & 2 deletions spec/ropen/events/event_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
end

it "should run events on the output of a stream" do
@event.should_receive(:start).ordered
@event.should_receive(:start).with(@command).ordered
@event.should_receive(:stdout).with(@command, "blah").ordered
@event.should_receive(:stdout).with(@command, "blee").ordered
@event.should_receive(:stderr).with(@command, "ERROR").ordered
@event.should_receive(:finish).ordered
@event.should_receive(:finish).with(@command).ordered

@stdout.should_receive(:eof?).and_return(false, false, true)
@stdout.should_receive(:readpartial).with(an_instance_of(Numeric)).and_return("blah", "blee")
Expand Down

0 comments on commit d8b2018

Please sign in to comment.