fix the make rdb debugging tool

This commit is contained in:
Ryan Petrello
2017-06-29 15:40:09 -04:00
parent 6d85c8bc9f
commit 611c42f741
2 changed files with 11 additions and 7 deletions

View File

@@ -155,9 +155,14 @@ class CustomPdb(Rdb):
return Rdb.displayhook(self, obj)
def get_avail_port(self, *args, **kwargs):
try:
socket.gethostbyname('docker.for.mac.localhost')
host = 'docker.for.mac.localhost'
except:
host = os.popen('ip route').read().split(' ')[2]
sock, port = Rdb.get_avail_port(self, *args, **kwargs)
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(
str(port), ('dockerhost', 6899)
str(port), (host, 6899)
)
return (sock, port)