From: Avery Pennarun Date: Tue, 13 Jul 2010 20:24:56 +0000 (-0400) Subject: cmd/web: print a nicer message if we can't bind the socket. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=98805befbcccd27869d9f5f70132a3e847477d75;p=packages%2Fb%2Fbup.git cmd/web: print a nicer message if we can't bind the socket. Signed-off-by: Avery Pennarun --- diff --git a/cmd/web-cmd.py b/cmd/web-cmd.py index b412044..2952315 100755 --- a/cmd/web-cmd.py +++ b/cmd/web-cmd.py @@ -185,8 +185,12 @@ if len(extra) > 0: 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()