Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0 regressions #325

Closed
rubys opened this issue Jun 29, 2015 · 2 comments
Closed

3.0 regressions #325

rubys opened this issue Jun 29, 2015 · 2 comments
Labels

Comments

@rubys
Copy link

rubys commented Jun 29, 2015

The following worked on 2.10, but fails on 3.0. Note that uncommenting out the require statements will get you further on 3.0, but not to completion:

require 'listen'
# require 'pathname'
# require 'timeout'

p File.expand_path('..', __FILE__)
listener = Listen.to(File.expand_path('..', __FILE__)) do |mod, add, del|
 p [mod, add, del] 
end
listener.start
listener.pause
listener.start
@rubys
Copy link
Author

rubys commented Jun 29, 2015

I'm also getting warnings:

/Library/Ruby/Gems/2.0.0/gems/listen-3.0.0/lib/listen/event/queue.rb:15: warning: toplevel constant Queue referenced by Thread::Queue
/Library/Ruby/Gems/2.0.0/gems/listen-3.0.0/lib/listen/event/loop.rb:15: warning: toplevel constant Queue referenced by Thread::Queue

The fix for this would be to drop Thread:: on those two lines.

@e2
Copy link
Contributor

e2 commented Jun 29, 2015

Thanks for reporting this! You're awesome!

I didn't test Listen in isolation properly - I'll get these fixed as soon as I can. (I never found a good way of testing Listen in isolation - usually other gems pull in the requirements so everything "works" during tests).

As a tip, you can set the LISTEN_GEM_DEBUGGING=2 environment variable to see debugging info.

Once I fix the few issues brought up here, you'll also need a sleep at the end, since Listen is non-blocking (I'm planning on adding a blocking mode, since it's quite useful and saves a thread, and sometimes makes things a bit simpler).

As a side note, the semantics of pause are supposed to be:

  • pause = suspend responding to events (calling the callback, but allow for accumulating and optimizing changes)
  • stop = stop listening to changes (which means changes can be missed, the internal snapshot record can become inconsistent, etc, and so stop() is generally avoided. If you have performance issues - e.g. high CPU usage and you think stop helps, open a ticket, and I'll see what can be done).

@e2 e2 closed this as completed in 0e2e18f Jun 29, 2015
e2 added a commit that referenced this issue Jun 29, 2015
Fix regressions (requires+pause error) [fix #325]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants