Fix SIGNPIPE doesn't exist on windows

This commit is contained in:
Tony 2023-04-19 00:45:40 +08:00 committed by Hamish Coleman
parent ece951c464
commit bfe42e3cc8

View File

@ -456,6 +456,7 @@ def main():
snrpc.debug = args.debug
snrpc.defaultkey = args.key
if hasattr(signal, 'SIGPIPE'):
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
socketserver.TCPServer.allow_reuse_address = True
@ -463,6 +464,7 @@ def main():
httpd = socketserver.TCPServer(("", args.port), handler)
try:
print(f"Serving HTTP at port {args.port} (http://localhost:{args.port}/) ...")
httpd.serve_forever()
except KeyboardInterrupt:
return