selftest: make sure dns_hub.py exits on SIGINT
[gd/samba-autobuild/.git] / 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_'))