Show main exception only with --verbose
This commit is contained in:
parent
6c526fd645
commit
b42b3dbce5
|
|
@ -402,21 +402,27 @@ def websockify_init():
|
||||||
try: opts.target_port = int(opts.target_port)
|
try: opts.target_port = int(opts.target_port)
|
||||||
except: parser.error("Error parsing target port")
|
except: parser.error("Error parsing target port")
|
||||||
|
|
||||||
# Transform to absolute path as daemon may chdir
|
try:
|
||||||
if opts.target_cfg:
|
# Transform to absolute path as daemon may chdir
|
||||||
opts.target_cfg = os.path.abspath(opts.target_cfg)
|
if opts.target_cfg:
|
||||||
|
opts.target_cfg = os.path.abspath(opts.target_cfg)
|
||||||
|
|
||||||
# Create and start the WebSockets proxy
|
# Create and start the WebSockets proxy
|
||||||
libserver = opts.libserver
|
libserver = opts.libserver
|
||||||
del opts.libserver
|
del opts.libserver
|
||||||
if libserver:
|
if libserver:
|
||||||
# Use standard Python SocketServer framework
|
# Use standard Python SocketServer framework
|
||||||
server = LibProxyServer(**opts.__dict__)
|
server = LibProxyServer(**opts.__dict__)
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
else:
|
else:
|
||||||
# Use internal service framework
|
# Use internal service framework
|
||||||
server = WebSocketProxy(**opts.__dict__)
|
server = WebSocketProxy(**opts.__dict__)
|
||||||
server.start_server()
|
server.start_server()
|
||||||
|
except:
|
||||||
|
if opts.verbose:
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
print >> sys.stderr, 'Unexpected error:', sys.exc_info()[1]
|
||||||
|
|
||||||
|
|
||||||
class LibProxyServer(ForkingMixIn, HTTPServer):
|
class LibProxyServer(ForkingMixIn, HTTPServer):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue