guard / guard-rspec

Guard::RSpec automatically run your specs (much like autotest)
https://rubygems.org/gems/guard-rspec
MIT License
1.31k stars 241 forks source link

Re: No such file or directory @ rb_sysopen - tmp/rspec_guard_result with a syntax error #390

Open dima4p opened 7 years ago

dima4p commented 7 years ago

re: https://github.com/guard/guard-rspec/issues/362

Hello, I've met the problem again and prepared debug info

$ beg -d
17:12:51 - DEBUG - Command execution: hash stty
17:12:51 - DEBUG - Guard starts all plugins
17:12:51 - DEBUG - Hook :start_begin executed for Guard::Bundler
17:12:52 - INFO - Bundle already up-to-date
17:12:52 - DEBUG - Hook :start_end executed for Guard::Bundler
17:12:52 - DEBUG - Hook :start_begin executed for Guard::LiveReload
17:12:52 - INFO - LiveReload is waiting for a browser to connect.
17:12:52 - DEBUG - Hook :start_end executed for Guard::LiveReload
17:12:52 - DEBUG - Hook :start_begin executed for Guard::RSpec
17:12:52 - INFO - Guard::RSpec is running
17:12:52 - DEBUG - Hook :start_end executed for Guard::RSpec
17:12:52 - DEBUG - Hook :start_begin executed for Guard::Spork
17:12:52 - DEBUG - Killing Spork servers with PID: 
17:12:52 - INFO - Starting Spork for RSpec
17:12:52 - DEBUG - guard-spork command execution: ["exec", "spork", "-p", "8989"]
Using RSpec, Rails
Preloading Rails environment
      ** Notice: The native BSON extension was not loaded. **

      For optimal performance, use of the BSON extension is recommended.

      To enable the extension make sure ENV['BSON_EXT_DISABLED'] is not set
      and run the following command:

        gem install bson_ext

      If you continue to receive this message after installing, make sure that
      the bson_ext gem is in your load path.

17:13:22 - ERROR - Could not start Spork server for RSpec after 30 seconds. I will continue waiting for a further 60 seconds.
Loading Spork.prefork block...
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/actionpack-3.2.22/lib/action_dispatch/http/mime_type.rb:102: warning: already initialized constant PDF
DEPRECATED: Passing a block to Capybara::server is deprecated, please use Capybara::register_server instead
Spork is ready and listening on 8989!
17:13:44 - INFO - Spork server for RSpec eventually started after 52 seconds. Consider adjusting your :wait option beyond this time.
17:13:44 - DEBUG - Hook :start_end executed for Guard::Spork
17:13:45 - INFO - Guard is now watching at '/home/dima/devel/mice/katalysator'
17:13:45 - DEBUG - Start interactor
17:14:35 - DEBUG - Interactor was stopped or killed
17:14:35 - DEBUG - Hook :run_on_modifications_begin executed for Guard::RSpec
17:14:35 - INFO - Running: spec spec/support/negotiations/contract_arbitrator_spec.rb
17:14:35 - DEBUG - Guard::RSpec: results file: /home/dima/devel/mice/katalysator/tmp/rspec_guard_result
Running tests with args ["--color", "--failure-exit-code", "2", "--format", "progress", "--format", "Guard::RSpecFormatter", "--require", "/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec_formatter.rb", "spec", "spec/support/negotiations/contract_arbitrator_spec.rb"]...
Exception encountered: #<SyntaxError: /home/dima/devel/mice/katalysator/spec/support/negotiations/contract_arbitrator_spec.rb:29: syntax error, unexpected '{', expecting keyword_end
    it 'should return value from Arbitrator' { should == 12 }
                                              ^
/home/dima/devel/mice/katalysator/spec/support/negotiations/contract_arbitrator_spec.rb:29: syntax error, unexpected '}', expecting keyword_end
/home/dima/devel/mice/katalysator/spec/support/negotiations/contract_arbitrator_spec.rb:35: syntax error, unexpected $end, expecting keyword_end>
backtrace:
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:245:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:245:in `block in load'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:245:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1361:in `block in load_spec_files'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1359:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1359:in `load_spec_files'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:106:in `setup'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:92:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/bundler/gems/spork-224df492657e/lib/spork/test_framework/rspec.rb:12:in `run_tests'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/bundler/gems/spork-224df492657e/lib/spork/run_strategy/forking.rb:13:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/bundler/gems/spork-224df492657e/lib/spork/forker.rb:21:in `block in initialize'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/bundler/gems/spork-224df492657e/lib/spork/forker.rb:18:in `fork'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/bundler/gems/spork-224df492657e/lib/spork/forker.rb:18:in `initialize'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/bundler/gems/spork-224df492657e/lib/spork/run_strategy/forking.rb:9:in `new'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/bundler/gems/spork-224df492657e/lib/spork/run_strategy/forking.rb:9:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/bundler/gems/spork-224df492657e/lib/spork/server.rb:49:in `run'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
Done.

17:14:57 - DEBUG - Guard::RSpec: RSpec command bundle exec rspec -c --drb -f progress -r /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec_formatter.rb -f Guard::RSpecFormatter --failure-exit-code 2  spec spec/support/negotiations/contract_arbitrator_spec.rb exited with: 0
17:14:57 - ERROR - Guard::RSpec cannot open results file: "/home/dima/devel/mice/katalysator/tmp/rspec_guard_result". This is likely a bugso please report this at http://github.com/guard/guard-rspec/issues/new along with as muchinformation as possible to reproduce this issue.
17:14:57 - ERROR - Guard::RSpec failed to achieve its <run_on_modifications>, exception was:
> [#] Errno::ENOENT: No such file or directory - /home/dima/devel/mice/katalysator/tmp/rspec_guard_result
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec/results.rb:11:in `readlines'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec/results.rb:11:in `initialize'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec/rspec_process.rb:57:in `new'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec/rspec_process.rb:57:in `_read_results'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec/rspec_process.rb:18:in `initialize'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec/runner.rb:65:in `new'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec/runner.rb:65:in `_really_run'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec/runner.rb:54:in `_run'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec/runner.rb:38:in `run'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec.rb:42:in `block in run_on_modifications'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec.rb:48:in `_throw_if_failed'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-rspec-4.7.3/lib/guard/rspec.rb:42:in `run_on_modifications'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:82:in `block in _supervise'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:79:in `catch'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:79:in `_supervise'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:61:in `block (3 levels) in run_on_changes'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:56:in `each'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:56:in `block (2 levels) in run_on_changes'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:119:in `block (2 levels) in _run_group_plugins'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:117:in `each'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:117:in `block in _run_group_plugins'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:116:in `catch'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:116:in `_run_group_plugins'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:54:in `block in run_on_changes'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:53:in `each'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/runner.rb:53:in `run_on_changes'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/internals/queue.rb:23:in `process'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/commander.rb:43:in `start'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/cli/environments/valid.rb:16:in `start_guard'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/cli.rb:122:in `start'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:32:in `execute'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:19:in `execute!'
> [#] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/bin/_guard-core:11:in `<main>'
17:14:57 - INFO - Guard::RSpec has just been fired
17:14:57 - DEBUG - Start interactor

The next save of the file does not perform the run just returning

17:16:06 - DEBUG - Interactor was stopped or killed
17:16:06 - DEBUG - Hook :run_on_additions_begin executed for Guard::Bundler
17:16:06 - INFO - Bundle already up-to-date
17:16:06 - DEBUG - Hook :run_on_additions_end executed for Guard::Bundler
17:16:06 - DEBUG - Start interactor
dima4p commented 7 years ago

When leaving guard via ^D I received

17:30:43 - DEBUG - Interactor was stopped or killed
17:30:43 - DEBUG - Guard stops all plugins
17:30:43 - DEBUG - Hook :stop_begin executed for Guard::LiveReload
17:30:43 - DEBUG - Hook :stop_end executed for Guard::LiveReload
17:30:43 - DEBUG - Hook :stop_begin executed for Guard::Spork
17:30:43 - DEBUG - Killing Spork servers with PID: 22011
E, [2016-11-08T17:30:43.533388 #21984] ERROR -- : run() in thread failed: undefined method `callback!' for nil:NilClass:\n /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/event.rb:128:in `callback!'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:238:in `block in process'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:238:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:238:in `process'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:221:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/adapter/linux.rb:38:in `_run'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/adapter/base.rb:78:in `block in start'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/internals/thread_pool.rb:6:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/internals/thread_pool.rb:6:in `block in add'\n\ncalled from:\n /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/backend.rb:26:in `start'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/listener.rb:67:in `block in <class:Listener>'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/fsm.rb:120:in `instance_eval'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/fsm.rb:120:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/fsm.rb:57:in `transition'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/listener.rb:90:in `start'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/commander.rb:35:in `start'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/cli/environments/valid.rb:16:in `start_guard'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/cli.rb:122:in `start'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:32:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:19:in `execute!'
/usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/guard-2.13.0/bin/_guard-core:11:in `<main>'
17:30:43 - ERROR - Guard::Spork failed to achieve its <stop>, exception was:
> [#0D8F44B3775F] NoMethodError: undefined method `callback!' for nil:NilClass
> [#0D8F44B3775F] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/event.rb:128:in `callback!'
> [#0D8F44B3775F] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:238:in `block in process'
> [#0D8F44B3775F] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:238:in `each'
> [#0D8F44B3775F] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:238:in `process'
> [#0D8F44B3775F] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/rb-inotify-0.9.5/lib/rb-inotify/notifier.rb:221:in `run'
> [#0D8F44B3775F] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/adapter/linux.rb:38:in `_run'
> [#0D8F44B3775F] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/adapter/base.rb:78:in `block in start'
> [#0D8F44B3775F] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/internals/thread_pool.rb:6:in `call'
> [#0D8F44B3775F] /usr/local/rvm/gems/ruby-1.9.3-p551@mp_katalysator/gems/listen-3.0.5/lib/listen/internals/thread_pool.rb:6:in `block in add'
17:30:43 - INFO - Guard::Spork has just been fired
17:30:43 - INFO - Bye bye...
cbrwizard commented 7 years ago

Hey, I am having almost the same issue.

screen shot 2017-03-24 at 16 52 52

Unfortunately none of the solutions provided in the related issues helped me.

ruby 2.3.3p222
guard (2.14.1)
guard-rspec (4.7.3)

Interesting is that it worked with this combo:

ruby 2.1.9p490
guard (2.13.0)
guard-rspec (4.6.4)

And also I found out that this combo also works:

ruby 2.3.3p222
guard (2.14.1)
guard-rspec (4.6.4)

That's why I conclude that the bug is in guard-rspec between 4.6.4 and 4.7.3

jeffmccune commented 7 years ago

guard-rspec's handling of the results file should be refactored and made more robust using mktemp(). There's a ton of issues going back a few years all related to being unable to open the results file.