简体   繁体   English

调试器在Rake任务中不起作用

[英]Debugger does not work in Rake task

I'm using ruby 2.1.0 and Rails 4.1.0 我正在使用ruby 2.1.0和Rails 4.1.0

If I put a debugger statement anywhere in my rake code, I get this: 如果我在rake代码中的任何地方放置debugger语句,则会得到以下信息:

home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/monitor.rb:213
mon_exit

[208, 217] in /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/monitor.rb
   208    def mon_synchronize
   209      mon_enter
   210      begin
   211        yield
   212      ensure
=> 213        mon_exit
   214      end
   215    end
   216    alias synchronize mon_synchronize
   217
(rdb:1)

I cannot access any of the local variables in my code. 我无法访问代码中的任何局部变量。 Monitor appears to be a threading library... so how do I get the debugger statement to run properly? Monitor似乎是一个线程库...所以如何使debugger语句正常运行?

The issue was putting " debugger " at the end of a method, which would make it the return value. 问题是将“ debugger ”放在方法的末尾,这将使其成为返回值。

The fix... don't put debugger at the end of a method. 解决方法...不要将debugger放在方法的末尾。

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

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