]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Exit quietly from k5test scripts on interrupt
authorGreg Hudson <ghudson@mit.edu>
Sun, 13 Mar 2016 16:20:43 +0000 (12:20 -0400)
committerGreg Hudson <ghudson@mit.edu>
Fri, 8 Apr 2016 21:01:09 +0000 (17:01 -0400)
Set up a SIGINT handler in k5test.py to avoid printing a stack trace
or debugging instructions on control-C.

src/util/k5test.py

index c1df32f05abaaba5bc554949f4b7c0be7e08c643..ff86bd9416bde279df835d4e8e912d02d699ad9f 100644 (file)
@@ -448,6 +448,14 @@ def _onexit():
         print '--stop-after=NUM to stop after a daemon is started in order to'
         print 'attach to it with a debugger.  Use --help to see other options.'
 
+
+def _onsigint(signum, frame):
+    # Exit without displaying a stack trace.  Suppress messages from _onexit.
+    global _success
+    _success = True
+    sys.exit(1)
+
+
 # Find the parent of dir which is at the root of a build or source directory.
 def _find_root(dir):
     while True:
@@ -1198,6 +1206,7 @@ _current_pass = None
 _daemons = []
 _parse_args()
 atexit.register(_onexit)
+signal.signal(signal.SIGINT, _onsigint)
 _outfile = open('testlog', 'w')
 _cmd_index = 1
 buildtop = _find_buildtop()