Skip to content

Instantly share code, notes, and snippets.

@gabrielbidula
Created July 16, 2016 17:33
Show Gist options
  • Save gabrielbidula/995e6748d34bcff673592746069b69f9 to your computer and use it in GitHub Desktop.
Save gabrielbidula/995e6748d34bcff673592746069b69f9 to your computer and use it in GitHub Desktop.
remote debug with pow
module Byebug
class << self
def start_remote_debugging
require "byebug/core"
require "byebug"
port = begin
server = TCPServer.new(nil, 0)
server.addr[1]
ensure
server.close if server
end
"Remote debugger on port #{port}".tap do |message|
puts message
Rails.logger.warn message
end
self.wait_connection = true
start_server('localhost', port)
attach
end
end
end
@gabrielbidula
Copy link
Author

gabrielbidula commented Jul 16, 2016

create the file above
type Byebug.start_remote_debugging somehere in the code
in terminal execute bundle exec byebug -R port(shown in the development.log)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment