简体   繁体   English

使用WDM宝石时,Guard静默退出

[英]Guard Silently Exits When Using WDM Gem

Whenever I try to use wdm in conjunction with guard on Windows, guard silently exits. 每当我尝试在Windows上结合使用wdm和guard时,guard都会自动退出。 However, if I force polling, then guard works correctly. 但是,如果我强制轮询,则防护功能将正常运行。 Probably the best way to illustrate this is with an example. 举例说明这一点的最佳方法可能就是一个例子。 This is what happens when I run guard with wdm: 这是我使用wdm进行防护时发生的情况:

C:/path/to/code>bundle exec guard init rspec
11:47:02 - INFO - rspec guard added to Guardfile, feel free to edit it

C:/path/to/code>bundle exec guard
11:48:06 - INFO - Guard is using TerminalTitle to send notifications.
11:48:06 - INFO - Guard::RSpec is running
11:48:06 - INFO - Guard is now watching at 'C:/path/to/code'

C:/path/to/code>

However, if I force guard to poll for changes, then it behaves correctly by ending up at a guard console: 但是,如果我强制警卫队轮询更改,那么它会通过在警卫控制台结束而正确运行:

C:/path/to/code>bundle exec guard -p
11:50:03 - INFO - Guard is using TerminalTitle to send notifications.
11:50:03 - INFO - Guard::RSpec is running
11:50:03 - INFO - Guard is now watching at 'C:/path/to/code'
[1] guard(main)>

I'm hoping that someone might have some light to shed on this problem. 我希望有人可能对此有所启发。 I have tried searching around quite a bit, but have not been able to find any answers to this question. 我已经尝试了很多搜索,但是未能找到该问题的任何答案。

Relevant Excerpts from my Gemfile: 我的Gemfile的相关摘录:

source 'http://rubygems.org'
ruby '1.9.3'
require "rbconfig"
gem 'rails', '3.2.13'
gem "figaro", ">= 0.5.3"
gem "rspec-rails", ">= 2.12.2", :group => [:development, :test]
gem "factory_girl_rails", ">= 4.2.0", :group => [:development, :test]
group :test do
    gem "capybara", ">= 2.0.2"
    gem "database_cleaner", ">= 0.9.1"
    gem "email_spec", ">= 1.4.0"
    gem "guard-rspec"
    gem "wdm", ">= 0.1.0" if RbConfig::CONFIG["target_os"] =~ /mswin|mingw|cygwin/i
end

My Guardfile: 我的Guardfile:

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard :rspec do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('spec/spec_helper.rb')  { "spec" }

  # Rails example
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$})          { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }

  # Capybara features specs
  watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$})     { |m| "spec/features/#{m[1]}_spec.rb" }

  # Turnip features and steps
  watch(%r{^spec/acceptance/(.+)\.feature$})
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$})   { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end

I don't have an answer to this, but I thought I might collect some of the issues that relate to it. 我没有答案,但我想我可能会收集一些与此有关的问题。

The primary issue is Problems on Windows in the listen gem. 首要的问题是在Windows上的问题listen宝石。

There is a related issue on guard is Guard 2.0.3 daemon doesn't stay running on windows which was closed in favour of the listen issue. 上有一个相关的问题guard卫队2.0.3守护程序不会留在Windows上运行这是有利于封闭listen问题。

The wdm gem also has an open issue: fail with listen gem . wdm gem也有一个未解决的问题: 使用listen gem失败

Sorry I can't solve it, but at least there are on-going issues for this problem. 抱歉,我无法解决,但至少这个问题持续存在。 The few people that work on Ruby for Windows are such gems! 在Ruby for Windows上工作的少数人就是这样的宝藏! I apologise for the pun :) 我为双关语道歉:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM