guard / rb-inotify

A thorough inotify wrapper for Ruby using FFI.
MIT License
312 stars 64 forks source link

[FIX] Guard crush on exit fix #51

Closed kvokka closed 7 years ago

kvokka commented 8 years ago

First commit fix changes between sourse from github and sourse from rubygems. It was very tricky

The second one fix guard crush on exit. My guard addition list is:

  gem 'guard'
  gem 'guard-migrate'
  gem 'guard-bundler', require: false
  gem 'guard-livereload', '~> 2.4', require: false
  gem 'guard-rspec', require: false
  gem 'guard-rails', require: false

and on exit i've got (it's not the last version of error, but enougth to get into the idea)

[1] guard(main)> exit                                                                                    

Exiting
E, [2016-01-21T22:17:37.085389 #17203] ERROR -- : run() in thread failed: undefined method `callback!' for nil:NilClass:\n /home/kvokka/.rvm/gems/ruby-2.3.0/gems/rb-inotify-0.9.5/lib/rb-inotify/event.rb:128:in `callback!'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:238:in `block in process'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:238:in `each'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:238:in `process'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:221:in `run'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/adapter/linux.rb:38:in `_run'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/adapter/base.rb:78:in `block in start'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/internals/thread_pool.rb:6:in `block in add'\n\ncalled from:\n /home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/backend.rb:26:in `start'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/listener.rb:67:in `block in <class:Listener>'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/fsm.rb:120:in `instance_eval'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/fsm.rb:120:in `call'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/fsm.rb:57:in `transition'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/listener.rb:90:in `start'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/commander.rb:35:in `start'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/cli/environments/valid.rb:16:in `start_guard'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/cli.rb:122:in `start'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:32:in `execute'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:19:in `execute!'
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/bin/_guard-core:11:in `<main>'

This fix swith off error raising

nex3 commented 8 years ago

The first commit looks like it's just reverting a bunch of pull requests that people have made since the gem was last released. That doesn't seem right.

kvokka commented 8 years ago

At first, I whant to say, that the copyes of gem at rubygems.org and at github are different and, copy from rubygems works correct, and github copy layed down. After this syncronization everything become normal. You can check it by yourself, just build this gem from sourse and try to use.

nex3 commented 8 years ago

In what way did the GitHub version work incorrectly?

kvokka commented 8 years ago

in context of bundle exec guard running

kvokka@kvokka-PC:~/proj/qna$ bundle exec guard
22:51:26 - INFO - [Guard::Rails] will start the default web server on port 3000 in development.
22:51:26 - INFO - Starting Rails...

=> Booting Puma
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Puma 2.15.3 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:3000
22:51:32 - INFO - Rails started, pid 7934

22:51:32 - INFO - Bundle already up-to-date
22:51:32 - INFO - Inspecting Ruby code style of all files
Inspecting 48 files
................................................

48 files inspected, no offenses detected
22:51:34 - INFO - Guard::RSpec is running
/home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/fsm.rb:76:in `validate_and_sanitize_new_state': Listen::Listener can't change state from 'backend_started' to 'stopped', only to: frontend_ready (ArgumentError)
        from /home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/fsm.rb:55:in `transition'
        from /home/kvokka/.rvm/gems/ruby-2.3.0/gems/listen-3.0.5/lib/listen/listener.rb:98:in `stop'
        from /home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:48:in `ensure in execute'
        from /home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:56:in `execute'
        from /home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:19:in `execute!'
        from /home/kvokka/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/bin/_guard-core:11:in `<main>'

Tested just now. And works correct with my patch.

e2 commented 8 years ago

Related: https://github.com/nex3/rb-inotify/pull/53

ioquatix commented 7 years ago

Can you please rebase on master and I will review.

ioquatix commented 7 years ago

I don't believe this fixes any outstaning issues. Please feel free to rebase and I will review.