Created
July 16, 2016 17:33
-
-
Save gabrielbidula/995e6748d34bcff673592746069b69f9 to your computer and use it in GitHub Desktop.
remote debug with pow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)