guard / guard

Guard is a command line tool to easily handle events on file system modifications.
MIT License
6.24k stars 483 forks source link

Guard sigINT (with or without test running) -> no longer watching #827

Open inspire22 opened 8 years ago

inspire22 commented 8 years ago

Might be related to https://github.com/guard/guard/issues/582

I'm on mac. When I save an (rspec) file, guard picks it up and runs the test just great.

If I hit ctrl+c from the guard command line, it'll stop slow tests (works great) - but stops watching files anymore - saves don't trigger any action.

If I hit ctrl+c even when a test is NOT running (immediately after startup), it still stops watching files.

The command line still responds to help and if I hit enter it'll run all specs manually.

e2 commented 8 years ago

I can't reproduce this, but I'm running on Linux.

First, just make sure you're using Guard 2.13.0.

Second, if you can, add a STDERR.puts "interrupted!" inside the trap for CTRL-C here:

https://github.com/guard/guard/blob/727c660/lib/guard.rb#L68

And whenever you press CTRL-C, you should see "interrupted!".

If that works, we can try to find out what's wrong.

e2 commented 8 years ago

The next step in working out what's wrong would be:

  1. List the output of bundle show (I'm interested mostly in the version of pry and listen).
  2. Run LISTEN_GEM_DEBUGGING=2 bundle exec guard -d and paste the output after pressing Ctrl-C
heidar commented 7 years ago

I also have the same problem, on latest OS X. Here are my outputs.

❯ LISTEN_GEM_DEBUGGING=2 bundle exec guard -d
RubyDep: WARNING: Your Ruby is outdated/buggy.
RubyDep: WARNING: Your Ruby is: 2.3.0 (buggy). Recommendation: upgrade to 2.3.1.
RubyDep: WARNING: (To disable warnings, see:http://github.com/e2/ruby_dep/wiki/Disabling-warnings )
I, [2017-03-28T21:29:15.209313 #59976]  INFO -- : Listen loglevel set to: 0
I, [2017-03-28T21:29:15.210198 #59976]  INFO -- : Listen version: 3.1.5
D, [2017-03-28T21:29:15.827409 #59976] DEBUG -- : Adapter: considering polling ...
D, [2017-03-28T21:29:15.827509 #59976] DEBUG -- : Adapter: considering optimized backend...
21:29:17 - DEBUG - Notiffany is using TerminalNotifier to send notifications.
21:29:18 - DEBUG - Command execution: hash stty
21:29:18 - DEBUG - Guard starts all plugins
21:29:18 - DEBUG - Hook :start_begin executed for Guard::RSpec
21:29:18 - INFO - Guard::RSpec is running
21:29:18 - DEBUG - Hook :start_end executed for Guard::RSpec
21:29:18 - DEBUG - Hook :start_begin executed for Guard::Bundler
21:29:18 - INFO - Bundle already up-to-date
21:29:18 - DEBUG - Hook :start_end executed for Guard::Bundler
D, [2017-03-28T21:29:18.975928 #59976] DEBUG -- : fsevent: watching: "/Users/x/project"
D, [2017-03-28T21:29:19.081929 #59976] DEBUG -- : Waiting for processing to start...
21:29:19 - INFO - Guard is now watching at '/Users/x/project'
21:29:19 - DEBUG - Start interactor
21:29:19 - DEBUG - Command execution: stty -g 2>/dev/null
I, [2017-03-28T21:29:19.919796 #59976]  INFO -- : Record.build(): 0.94339 seconds
D, [2017-03-28T21:29:19.920883 #59976] DEBUG -- : fsevent: running worker: #<FSEvent:0x007ff1ebdde980 @paths=["/Users/x/project"], @callback=#<Proc:0x007ff1ebddea98@/Users/x/.gem/ruby/2.3.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:41 (lambda)>, @options=["--latency", "0.1"]>
[1] guard(main)> interrupted! # CTRL-C

[1] guard(main)> interrupted! # CTRL-C

[1] guard(main)> # CTRL+D
21:29:57 - DEBUG - Interactor was stopped or killed
21:29:57 - DEBUG - Command execution: stty  2>/dev/null
D, [2017-03-28T21:29:57.336611 #59976] DEBUG -- : Processing stopped
21:29:57 - DEBUG - Guard stops all plugins
21:29:57 - INFO - Bye bye...
❯ bundle show pry
/Users/x/.gem/ruby/2.3.0/gems/pry-0.10.4
❯ bundle show guard
/Users/x/.gem/ruby/2.3.0/gems/guard-2.14.1
❯ bundle show listen
/Users/x/.gem/ruby/2.3.0/gems/listen-3.1.5

Does that help? Would really like to solve this since I find myself wasting a lot of time stopping slow tests, exiting guard, and starting it again. :)