Skip to content

Commit

Permalink
Merge pull request ninja-build#470 from rgeary1/remotebrowser
Browse files Browse the repository at this point in the history
Ninja -t browse opens localhost in browser, which doesn't work when using ssh
  • Loading branch information
evmar committed May 23, 2013
2 parents 6eeb53f + 07049a3 commit 145d4f2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import http.server as httpserver
except ImportError:
import BaseHTTPServer as httpserver
import os
import socket
import subprocess
import sys
import webbrowser
Expand Down Expand Up @@ -183,8 +185,10 @@ def log_message(self, format, *args):
port = 8000
httpd = httpserver.HTTPServer(('',port), RequestHandler)
try:
print('Web server running on port %d, ctl-C to abort...' % port)
webbrowser.open_new('http://localhost:%s' % port)
hostname = socket.gethostname()
print('Web server running on %s:%d, ctl-C to abort...' % (hostname,port) )
print('Web server pid %d' % os.getpid(), file=sys.stderr )
webbrowser.open_new('http://%s:%s' % (hostname, port) )
httpd.serve_forever()
except KeyboardInterrupt:
print()
Expand Down

0 comments on commit 145d4f2

Please sign in to comment.