Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 443f57efce8876d73e6c954783e62c16f3f43f22 1 parent 22001c5
@hron authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/guard/interactor.rb
View
8 lib/guard/interactor.rb
@@ -9,7 +9,7 @@ def initialize
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 @@ def start
end
end
+ def stop
+ @thread.kill
+ end
+
def lock
@locked = true
+ stop
end
def unlock
@locked = false
+ start
end
end

0 comments on commit 443f57e

Please sign in to comment.
Something went wrong with that request. Please try again.