selftest: make sure dns_hub.py exits on SIGINT
authorStefan Metzmacher <metze@samba.org>
Fri, 13 Mar 2020 06:06:05 +0000 (07:06 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 27 Mar 2020 09:02:37 +0000 (09:02 +0000)
Otherwise we have a deadlock in the python threading
that prevents out EOF detection on stdin to work
if someone aborts 'make test' with strg+c.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
selftest/target/dns_hub.py

index dcf59dcd701d0f115549ddd61353bd022fecd435..6b3c0f0708729434163f5746be012c9512b66a17 100755 (executable)
@@ -37,6 +37,11 @@ else:
 
 DNS_REQUEST_TIMEOUT = 10
 
+# make sure the script dies immediately when hitting control-C,
+# rather than raising KeyboardInterrupt. As we do all database
+# operations using transactions, this is safe.
+import signal
+signal.signal(signal.SIGINT, signal.SIG_DFL)
 
 class DnsHandler(sserver.BaseRequestHandler):
     dns_qtype_strings = dict((v, k) for k, v in vars(dns).items() if k.startswith('DNS_QTYPE_'))