guard / guard-rspec

Guard::RSpec automatically run your specs (much like autotest)

Home Page:https://rubygems.org/gems/guard-rspec

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No error when 'cmd' option is not found

bendyorke opened this issue · comments

I spent a couple hours trying to solve this... mainly because there was no error. I was getting:

WARN: Unresolved specs during Gem::Specification.reset:
      rspec (< 4.0, >= 2.14)

so I tried to fix it with

guard :rspec, :cmd => "bx rspec" do ... end

bx is aliased to bundle exec on my machine. The error is that guard doesn't have access to aliases, so

guard :rspec, :cmd => "bundle exec rspec" do ... end

worked fine. However, if you put anything in the 'cmd' option that isn't a valid command, it just interrupts and does not give any error.

This is what you see with guard

[1] guard(main)>
13:40:33 - INFO - Run all
13:40:33 - INFO - Running all specs

[2] guard(main)>

This is what you see with guard -d

[2] guard(main)>
13:39:13 - DEBUG - Command execution: stty gfmt1:cflag=4b00:iflag=6b02:lflag=5cb:oflag=3:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=9600:ospeed=9600
[2] guard(main)>
13:39:13 - DEBUG - Command execution: stty gfmt1:cflag=4b00:iflag=6b02:lflag=5cb:oflag=3:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=9600:ospeed=9600 2>/dev/null
13:39:13 - INFO - Run all
13:39:13 - DEBUG - Hook :run_all_begin executed for Guard::RSpec
13:39:13 - INFO - Running all specs
13:39:13 - DEBUG - Command execution: tmux -V
13:39:13 - DEBUG - Command execution: tmux set -q status-left-bg red

13:39:13 - DEBUG - Command execution: stty -g 2>/dev/null
13:39:13 - DEBUG - Command execution: stty echo 2>/dev/null
13:39:13 - DEBUG - Command execution: stty -a
13:39:13 - DEBUG - Command execution: stty -g
13:39:13 - DEBUG - Command execution: stty -a
13:39:13 - DEBUG - Command execution: stty -a
13:39:13 - DEBUG - Command execution: stty  -echo -icrnl cbreak pass8 -ixoff
[3] guard(main)>

It was a stupid mistake, but a quick error would have saved me a lot of time

@bendyorke Yeah, it is good idea to notify about cmd execution failure.

@bendyorke I've just tried to use bad :cmd. Guard report:

01:00:05 - ERROR - Guard::RSpec failed to achieve its <run_on_modifications>, exception was:
> [#] Errno::ENOENT: No such file or directory - bin/rspec1
> [#] /home/laise/.rvm/gems/ruby-2.1.2@epayservices-partners-program/gems/guard-rspec-4.2.8/lib/guard/rspec/runner.rb:40:in ``'
...

@bendyorke The :cmd option is mandatory now since 4.3.0.