ruby-debug with Pow — breakpoints never hit

时间秒杀一切 提交于 2019-12-03 13:02:21

This happens because Pow runs two worker processes as default, and rdebug only connects to one of them. If the other process serves the request, then no dice. The solution is to force Pow to run a single worker process, as follows:

  1. Edit ~/.powconfig to contain export POW_WORKERS=1
  2. Restart Pow itself by killing the Pow process

You should now hit your breakpoint on every request.

Update Sept '12

I switched to the debugger gem - a fork of ruby-debug19 with better support for ruby 1.9.2/3

This also allowed to simplify the configuration for remote-debugging in development.rb. I hit the breakpoint every single time and have no hanging processes.

require 'debugger'
Debugger.start_remote

Original Answer

Try enabling wait_connection (and restart pow)

require 'ruby-debug'
Debugger.wait_connection = true
Debugger.start_remote
Debugger.settings[:autoeval] = true
puts "=> Debugger enabled"

reload source is also nice: Debugger.settings[:reload_source_on_change] = true

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!