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

When using -G option, the wrong file is watched to restart Guard #857

Open
georgeu2000 opened this issue Oct 5, 2016 · 2 comments
Open
Labels

Comments

@georgeu2000
Copy link

guard -G Guardfile.client

I have 2 Guard files: Guardfile and Guardfile.client. They work fine together, using guard-process. I run them in 2 separate terminals.

The issue is that when I save Guardfile.client, Guard does not restart. When I save Guardfile, both restart with WARN - Guardfile changed -- _guard-core will exit.

The expected behavior is that when I save Guardfile, the guard that is watching that file should restart. When I save Guardfile.client, the guard that is watching that file should restart.

@e2 e2 added the bug label Oct 9, 2016
@e2
Copy link
Contributor

e2 commented Oct 9, 2016

Yes, it's a bug because Guard should use the Guardfile given on the commandline.

Instead, it's using fixed rules:

https://github.com/guard/guard/blob/28b2dc4/lib/guard.rb#L154

@chriso0710
Copy link

chriso0710 commented May 18, 2017

I just found this issue and I believe I can see the same behaviour in my context. Writing some details below for anyone who might trip over this bug.

I have my Guardfile in a subdir, which is watched by Guard. (I don't want to recursively watch the whole project root, because of performance and symlinks)
I start Guard via this command in my procfile

 guard: bundle exec guard start -G guardwatch/Guardfile -i -w models controllers i18n test guardwatch 

When changing the Guardfile I get the following error message

11:07:09 guard.1     | E, [2017-05-18T11:07:09.121977 #23635] ERROR -- : exception while processing events: No such file or directory @ realpath_rec - /Users/co/projects/myproject/Guardfile Backtrace:
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/guard-2.13.0/lib/guard.rb:157:in `realpath'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/guard-2.13.0/lib/guard.rb:157:in `realpath'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/guard-2.13.0/lib/guard.rb:157:in `_guardfile_deprecated_check'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/guard-2.13.0/lib/guard.rb:121:in `block in _listener_callback'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/event/config.rb:23:in `call'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/event/config.rb:23:in `call'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/event/processor.rb:115:in `_process_changes'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/event/processor.rb:19:in `block in loop_for'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/event/processor.rb:15:in `loop'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/event/processor.rb:15:in `loop_for'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/event/loop.rb:84:in `_wait_for_changes'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/event/loop.rb:42:in `block in setup'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/internals/thread_pool.rb:6:in `call'
11:07:09 guard.1     |  -- /Users/co/.rvm/gems/ruby-2.2.1@myproject/gems/listen-3.0.5/lib/listen/internals/thread_pool.rb:6:in `block in add'

Error goes away when I symlink the Guardfile from my project root dir to guardwatch/Guardfile

lrwxr-xr-x  1 co  staff  20 18 Mai 11:12 Guardfile -> guardwatch/Guardfile
11:23:05 guard.1     | 11:23:05 - WARN - Guardfile changed -- _guard-core will exit.
11:23:05 guard.1     | > [#] 
11:23:05 - INFO - Bye bye...
11:23:05 guard.1     | 
11:23:05 guard.1     | 
11:23:05 guard.1     | 
11:23:05 guard.1     | 11:23:05 - INFO - Using Guardfile at /Users/co/projects/myproject/guardwatch/Guardfile.

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

3 participants