Fix interacting with tools like ruby-debug.
It seems like the new interactor eats input from $stdin even while it locked. This disallow using tools like 'ruby-debug' or 'pry' in specs or cucumber. The fix just kills the interactor when it is locked and runs it again when ulocked.
This commit is contained in:
parent
22001c5ecd
commit
443f57efce
@ -9,7 +9,7 @@ module Guard
|
||||
|
||||
def start
|
||||
return if ENV["GUARD_ENV"] == 'test'
|
||||
Thread.new do
|
||||
@thread = Thread.new do
|
||||
loop do
|
||||
if (entry = $stdin.gets) && !@locked
|
||||
entry.gsub! /\n/, ''
|
||||
@ -28,12 +28,18 @@ module Guard
|
||||
end
|
||||
end
|
||||
|
||||
def stop
|
||||
@thread.kill
|
||||
end
|
||||
|
||||
def lock
|
||||
@locked = true
|
||||
stop
|
||||
end
|
||||
|
||||
def unlock
|
||||
@locked = false
|
||||
start
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user