From 98805befbcccd27869d9f5f70132a3e847477d75 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Tue, 13 Jul 2010 16:24:56 -0400 Subject: [PATCH] cmd/web: print a nicer message if we can't bind the socket. Signed-off-by: Avery Pennarun --- cmd/web-cmd.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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() -- 2.39.2