Permalink
Browse files

cmd/web: print a nicer message if we can't bind the socket.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
  • Loading branch information...
1 parent 4a4e7f1 commit 98805befbcccd27869d9f5f70132a3e847477d75 @apenwarr committed Jul 13, 2010
Showing with 7 additions and 3 deletions.
  1. +7 −3 cmd/web-cmd.py
View
@@ -185,8 +185,12 @@ def _guess_type(self, path):
git.check_repo_or_die()
top = vfs.RefList(None)
-httpd = BupHTTPServer(address, BupRequestHandler)
+try:
+ httpd = BupHTTPServer(address, BupRequestHandler)
+except socket.error, e:
+ log('socket%r: %s\n' % (address, e.args[1]))
+ sys.exit(1)
+
sa = httpd.socket.getsockname()
-print "Serving HTTP on %s:%d..." % sa
-sys.stdout.flush()
+log("Serving HTTP on %s:%d...\n" % sa)
httpd.serve_forever()

0 comments on commit 98805be

Please sign in to comment.