2016-04-29 51 views
1

ENV變量Errno :: EPERM:操作不允許@ unlink_internal - TMP/rspec_guard_result

ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

Rails 4.2.0

Guard version 2.13.0

問題:

餘噸嗯,這不是因爲規格本身,因爲它打字時正常工作bundle exec rspec xxx_spec.rb

我運行一個rm -rf /tmp意外之前運行此命令,我認爲這是在tmp/rspec_guard_result錯誤的原因。但不知道如何解決它。

運行的所有功能後,它顯示了以下結果:

結果

Finished in 1 minute 15.84 seconds (files took 0.46012 seconds to load) 
177 examples, 1 failure, 3 pending 

Failed examples: 

rspec ./spec/models/xxxxxx_spec.rb:88 # xxxx valid should xxxxxx 
07:36:42 - ERROR - Guard::RSpec failed to achieve its <run_all>, exception was: 
> [#a47cf0a740cd] Errno::EPERM: Operation not permitted @ unlink_internal - tmp/rspec_guard_result 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec/runner.rb:79:in `delete' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec/runner.rb:79:in `_command_output' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec/runner.rb:100:in `_process_run_result' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec/runner.rb:45:in `block in _run' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec/runner.rb:44:in `tap' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec/runner.rb:44:in `_run' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec/runner.rb:24:in `run_all' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec.rb:33:in `block in run_all' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec.rb:48:in `_throw_if_failed' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-rspec-4.5.0/lib/guard/rspec.rb:33:in `run_all' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:82:in `block in _supervise' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:79:in `catch' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:79:in `_supervise' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:22:in `block (3 levels) in run' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:119:in `block (2 levels) in _run_group_plugins' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:117:in `each' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:117:in `block in _run_group_plugins' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:116:in `catch' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:116:in `_run_group_plugins' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:21:in `block (2 levels) in run' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:20:in `each' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:20:in `block in run' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/lumberjack-1.0.10/lib/lumberjack.rb:32:in `unit_of_work' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/runner.rb:18:in `run' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/commander.rb:82:in `run_all' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/internals/queue.rb:42:in `block in _run_actions' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/internals/queue.rb:37:in `each' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/internals/queue.rb:37:in `_run_actions' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/internals/queue.rb:21:in `process' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/commander.rb:43:in `start' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/cli/environments/valid.rb:16:in `start_guard' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/cli.rb:122:in `start' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:32:in `execute' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:19:in `execute!' 
> [#a47cf0a740cd] /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/guard-2.13.0/bin/_guard-core:11:in `<main>' 
07:36:42 - INFO - Guard::RSpec has just been fired 
[1] guard(main)> 

回答

1

這也可能是最好開在衛隊-的RSpec問題的論文各種各樣的東西。 (你會得到一個響應並且修復得更快,並且你會知道修復何時發佈等)。

首先,升級到guard-rspec 4.6.5。這只是爲了確保你沒有其他問題。

現在,你有兩個選擇:

  1. 避免刪除整個tmp目錄,並刪除你在這裏創建的文件。這是「最好的」解決方案,因爲多個工具可以在那裏創建文件。

  2. 如果您確實想自己刪除tmp,那麼只需手動將results_file選項設置爲除tmp/rspec_guard_result之外的其他值即可。

    guard :rspec, results_file: 'guardfile_results.txt' do 
    
+0

謝謝Cezary Baginski。工作! – kkt

+0

但1不好。我刪除了文件「app/tmp/guardfile_results」,但仍顯示相同的錯誤。我怎樣才能恢復該文件? – kkt

+0

當您啓動rspec測試時,該文件由guard-rspec自動創建,並且在rspec測試完成(或失敗)時將被刪除。那個文件是guard-rspec存儲測試結果的地方,如果你必須確保你自己不刪除那個文件。如果刪除它,guard-rspec將無法正確報告規格結果。所以不是刪除tmp,而是刪除guardfile_results以外的所有文件,所以guard-rspec可以自己創建和刪除它。 –

相關問題