How to use Byebug with a remote process (e.g., pow)

后端 未结 2 1280
遥遥无期
遥遥无期 2021-01-30 04:43

How do I connect to a remote debugging instance of Byebug (for use with Pow, etc)?

2条回答
  •  一整个雨季
    2021-01-30 05:10

    I had to piece together information from several different sources to accomplish the above, so I thought I'd include a consolidated guide here for convenience:

    • https://github.com/deivid-rodriguez/byebug/pull/29,
    • https://github.com/deivid-rodriguez/byebug/pull/36,
    • https://github.com/deivid-rodriguez/byebug/issues/31
    • http://mines.mouldwarp.com/2012/04/pow-guard-and-rdebug-staying-in-web-app.html

    Here are the steps:

    1. In config/environments/development.rb, add:

      require 'byebug'
      
      #set in your .powconfig
      if ENV['RUBY_DEBUG_PORT']
        Byebug.start_server 'localhost', ENV['RUBY_DEBUG_PORT'].to_i
      else
        Byebug.start_server 'localhost'
      end
      
    2. Restart Pow and visit yourapp.dev

    3. Run the following:

      [bundle exec] byebug -R localhost:
      

    You should see a successful connection to the remote instance.

提交回复
热议问题