summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2013-05-23 21:22:17 (GMT)
committerEvan Martin <martine@danga.com>2013-05-23 21:22:17 (GMT)
commit145d4f2f2cf54771f663caa99d9da690eee6438e (patch)
tree7702778a61fdaf225d56816bb0ec98278bbccfca /src
parent6eeb53f6b8d02ccbcb1e006ad3632407831bc495 (diff)
parent07049a3be65428e12f352ce48f2f592a18d07483 (diff)
downloadNinja-145d4f2f2cf54771f663caa99d9da690eee6438e.zip
Ninja-145d4f2f2cf54771f663caa99d9da690eee6438e.tar.gz
Ninja-145d4f2f2cf54771f663caa99d9da690eee6438e.tar.bz2
Merge pull request #470 from rgeary1/remotebrowser
Ninja -t browse opens localhost in browser, which doesn't work when using ssh
Diffstat (limited to 'src')
-rwxr-xr-xsrc/browse.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/browse.py b/src/browse.py
index 652bac2..9e59bd8 100755
--- a/src/browse.py
+++ b/src/browse.py
@@ -26,6 +26,8 @@ try:
import http.server as httpserver
except ImportError:
import BaseHTTPServer as httpserver
+import os
+import socket
import subprocess
import sys
import webbrowser
@@ -183,8 +185,10 @@ class RequestHandler(httpserver.BaseHTTPRequestHandler):
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()