From bfe42e3cc82ee3c7f825f9d4da553a97194ad683 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 19 Apr 2023 00:45:40 +0800 Subject: [PATCH] Fix SIGNPIPE doesn't exist on windows --- scripts/n2n-httpd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/n2n-httpd b/scripts/n2n-httpd index a875047..b200bf8 100755 --- a/scripts/n2n-httpd +++ b/scripts/n2n-httpd @@ -456,13 +456,15 @@ def main(): snrpc.debug = args.debug snrpc.defaultkey = args.key - signal.signal(signal.SIGPIPE, signal.SIG_DFL) + if hasattr(signal, 'SIGPIPE'): + signal.signal(signal.SIGPIPE, signal.SIG_DFL) socketserver.TCPServer.allow_reuse_address = True handler = functools.partial(SimpleHandler, rpc, snrpc) 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