lib/expectr.rb in expectr-2.0.1 vs lib/expectr.rb in expectr-2.0.2
- old
+ new
@@ -315,10 +315,13 @@
match = nil
@thread = Thread.current
while match.nil?
@out_mutex.synchronize do
match = pattern.match(@buffer)
- @out_mutex.sleep if match.nil?
+ if match.nil?
+ raise Timeout::Error if @pid.zero?
+ @out_mutex.sleep
+ end
end
end
match
ensure
@thread = nil