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
|
def start
|
||||||
return if ENV["GUARD_ENV"] == 'test'
|
return if ENV["GUARD_ENV"] == 'test'
|
||||||
Thread.new do
|
@thread = Thread.new do
|
||||||
loop do
|
loop do
|
||||||
if (entry = $stdin.gets) && !@locked
|
if (entry = $stdin.gets) && !@locked
|
||||||
entry.gsub! /\n/, ''
|
entry.gsub! /\n/, ''
|
||||||
@ -28,12 +28,18 @@ module Guard
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stop
|
||||||
|
@thread.kill
|
||||||
|
end
|
||||||
|
|
||||||
def lock
|
def lock
|
||||||
@locked = true
|
@locked = true
|
||||||
|
stop
|
||||||
end
|
end
|
||||||
|
|
||||||
def unlock
|
def unlock
|
||||||
@locked = false
|
@locked = false
|
||||||
|
start
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user