Ruby on Rails.捆绑器.黄瓜.耙中止!命令失败,状态为 (1)黄瓜、命令、状态、Ruby

2023-09-09 21:15:24 作者:男人的兽性永远高于理性

在 Rails 3 中使用 Bundler 和 Cucumber 时遇到问题.

当我运行 $ rake cucumber 我得到以下输出:

bundle exec/usr/local/bin/ruby -I "/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib:lib" "/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/bin/cucumber" --profile 默认(在/home//practice/rails/blog)使用默认配置文件...呜呜呜1 个场景(1 个未定义)4 个步骤(4 个未定义)0m1.552s您可以使用以下代码片段为未定义的步骤实现步骤定义:给定/^a post$/做pending # 用你希望的代码表达上面的正则表达式结尾给定/^a name is specified$/dopending # 用你希望的代码表达上面的正则表达式结尾当/^我保存帖子$/时pending # 用你希望的代码表达上面的正则表达式结尾然后/^帖子应该节省$/做pending # 用你希望的代码表达上面的正则表达式结尾耙中止!命令失败,状态为 (1):[bundle exec/usr/local/bin/ruby -I "/usr/l...]/usr/local/lib/ruby/1.9.1/rake.rb:993:in `block in sh'/usr/local/lib/ruby/1.9.1/rake.rb:1008:in `call'/usr/local/lib/ruby/1.9.1/rake.rb:1008:in `sh'/usr/local/lib/ruby/1.9.1/rake.rb:1092:in `sh'/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/rake/task.rb:72:in `run'/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/rake/task.rb:142:in `block in define_task'/usr/local/lib/ruby/1.9.1/rake.rb:634:in `call'/usr/local/lib/ruby/1.9.1/rake.rb:634:in `block in execute'/usr/local/lib/ruby/1.9.1/rake.rb:629:in `每个'/usr/local/lib/ruby/1.9.1/rake.rb:629:在执行"中/usr/local/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'/usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'/usr/local/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites'/usr/local/lib/ruby/1.9.1/rake.rb:602:in `每个'/usr/local/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites'/usr/local/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain'/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'/usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'/usr/local/lib/ruby/1.9.1/rake.rb:581:in `invoke'/usr/local/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `每个'/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'/usr/local/lib/ruby/1.9.1/rake.rb:2013:in `top_level'/usr/local/lib/ruby/1.9.1/rake.rb:1992:在运行"中/usr/local/bin/rake:31:in `'RubyMine 2019.2.1发布

尽管有此输出,但我的功能工作正常,当我添加步骤定义并传递它们时,所有更改都会正确显示在控制台中.

这是我的 Gemfile:

组:开发,:测试做宝石'黄瓜导轨'gem 'rspec-rails', '>= 2.0.0.beta.22'宝石硒"宝石薄"宝石'webrat'结尾

我想注意,如果我使用 bundle exec cucumbercucumber features/ 命令,我不会收到任何错误消息.

这个问题的原因是什么?我该如何解决?

谢谢.

Debian GNU/Linux 5.0.6;

红宝石 1.9.2;

Ruby on Rails 3.0.0;

捆绑器 1.0.0;

黄瓜 0.8.5;

Cucumber-Rails 0.3.2.

解决方案

我也看到了同样的问题.通过一点点搜索,我可以弄清楚这个错误来自哪里,但仍然不知道如何解决它.

问题是bundle exec ..."shell 调用以状态码1"退出.这是 rake.rb 脚本的错误,因此它会抛出这些行.看起来这只是某种虚惊.

此外,只有在所有场景都通过时才会发生这种情况.即使有一个失败,您也不会看到此错误.

I have a problem using Bundler and Cucumber with Rails 3.

When I run $ rake cucumber I get the following output:

bundle exec /usr/local/bin/ruby -I "/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-
0.8.5/lib:lib" "/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/bin/cucumber"  --profile default
(in /home/<username>/practice/rails/blog)
Using the default profile...
UUUU

1 scenario (1 undefined)
4 steps (4 undefined)
0m1.552s

You can implement step definitions for undefined steps with these snippets:

Given /^a post$/ do
  pending # express the regexp above with the code you wish you had
end

Given /^a name was specified$/ do
  pending # express the regexp above with the code you wish you had
end

When /^I save the post$/ do
  pending # express the regexp above with the code you wish you had
end

Then /^the post should be saving$/ do
  pending # express the regexp above with the code you wish you had
end

rake aborted!
Command failed with status (1): [bundle exec /usr/local/bin/ruby -I "/usr/l...]
/usr/local/lib/ruby/1.9.1/rake.rb:993:in `block in sh'
/usr/local/lib/ruby/1.9.1/rake.rb:1008:in `call'
/usr/local/lib/ruby/1.9.1/rake.rb:1008:in `sh'
/usr/local/lib/ruby/1.9.1/rake.rb:1092:in `sh'
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/rake/task.rb:72:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/rake/task.rb:142:in `block in define_task'
/usr/local/lib/ruby/1.9.1/rake.rb:634:in `call'
/usr/local/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
/usr/local/lib/ruby/1.9.1/rake.rb:629:in `each'
/usr/local/lib/ruby/1.9.1/rake.rb:629:in `execute'
/usr/local/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites'
/usr/local/lib/ruby/1.9.1/rake.rb:602:in `each'
/usr/local/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites'
/usr/local/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/rake.rb:581:in `invoke'
/usr/local/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `each'
/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
/usr/local/lib/ruby/1.9.1/rake.rb:1992:in `run'
/usr/local/bin/rake:31:in `'

Despite this output my features works fine and when I add step definitions and pass them all the changes are displayed in a console correctly.

Here's my Gemfile:

group :development, :test do
  gem 'cucumber-rails'
  gem 'rspec-rails', '>= 2.0.0.beta.22'
  gem 'Selenium'
  gem 'thin'
  gem 'webrat'
end

I want to note, if I use the bundle exec cucumber or cucumber features/ commands I don't get any error messages.

What is the reason of this issue? How can I solve it?

Thanks.

Debian GNU/Linux 5.0.6;

Ruby 1.9.2;

Ruby on Rails 3.0.0;

Bundler 1.0.0;

Cucumber 0.8.5;

Cucumber-Rails 0.3.2.

解决方案

I am also seeing the same problem. With a little hunting I could figure where this error is coming but still don't know how to fix it.

The issue is that the "bundle exec ..." shell call is exiting with status code "1". That is an error for the rake.rb script and therefore it is throwing those lines. Looks like it is some kind of a false alarm only.

Also, this happens only when all the scenarios pass. If there is even a single failure, you will not see this error.