Permalink
Browse files

Move the grouping of threads to IRB::Driver.current=

  • Loading branch information...
1 parent 939594e commit 8595f5e4a2fa4e1dd64721cce7908a0b028258cb @alloy committed Jul 14, 2010
Showing with 5 additions and 3 deletions.
  1. +1 −0 lib/irb/driver.rb
  2. +0 −3 lib/irb/driver/tty.rb
  3. +4 −0 spec/driver_spec.rb
View
@@ -2,6 +2,7 @@ module IRB
module Driver
class << self
def current=(driver)
+ ThreadGroup.new.add(Thread.current)
Thread.current[:irb_driver] = driver
end
View
@@ -8,9 +8,6 @@ class TTY
def initialize(input = $stdin, output = $stdout)
@input = input
@output = output
-
- @thread_group = ThreadGroup.new
- @thread_group.add(Thread.current)
end
def readline(context)
View
@@ -20,6 +20,10 @@ def output
end
it "returns the same driver for child threads" do
+ Thread.new do
+ IRB::Driver.current = other = StubDriver.new
+ Thread.new { IRB::Driver.current.should == other }.join
+ end.join
Thread.new { IRB::Driver.current.should == @driver }.join
end
end

0 comments on commit 8595f5e

Please sign in to comment.