guard/listen — Issue #12: Issue with running with Rubinius
Author: dbussink
Created: 2012-03-09 17:14:46+00:00
State: open

I've investigated the issue you're having with running the tests on Travis CI with Rubinius. The problem is the following line:

https://github.com/guard/listen/blob/master/lib/listen/adapters/polling.rb#L40

The problem here is that MRI doesn't warn about this code, it actually evaluates as follows:

sleep(0.1 && next) if @paused

This is probably not what you want and this will actually never really sleep, since 0.1 && next is evaluated first. It's also so that next / break etc. have a special expression value, for example try the following:

puts next

That will result in:

SyntaxError: compile error
(irb):2: void value expression
from (irb):2
from :0

So in case of MRI it's more of a bug that it works there, since it should actually give you a similar error as to the one I just showed. As for a fix, simply adding parenthesis like this should fix the issue:

sleep(0.1) && next if @paused