# HG changeset patch # User Bernhard Urban # Date 1394556501 -3600 # Node ID ee66410c067992985759a9889fcb0165653a0c3f # Parent e71d421370f3b3adfc3b4ced6290aa570538771e mx: add option to send sigquit before killing child diff -r e71d421370f3 -r ee66410c0679 mxtool/mx.py --- a/mxtool/mx.py Tue Mar 11 18:36:49 2014 +0100 +++ b/mxtool/mx.py Tue Mar 11 17:48:21 2014 +0100 @@ -1032,6 +1032,7 @@ self.add_argument('--user-home', help='users home directory', metavar='', default=os.path.expanduser('~')) self.add_argument('--java-home', help='bootstrap JDK installation directory (must be JDK 6 or later)', metavar='') self.add_argument('--ignore-project', action='append', dest='ignored_projects', help='name of project to ignore', metavar='', default=[]) + self.add_argument('--kill-with-sigquit', action='store_true', dest='killwithsigquit', help='send sigquit first before killing child processes') if get_os() != 'windows': # Time outs are (currently) implemented with Unix specific functionality self.add_argument('--timeout', help='timeout (in seconds) for command', type=int, default=0, metavar='') @@ -1463,8 +1464,7 @@ abort('Property contains an undefined environment variable: ' + value) return result - -def quit_handler(signum, frame): +def _send_sigquit(): p, _ = _currentSubprocess if p is not None: if get_os() == 'windows': @@ -1481,6 +1481,9 @@ the object's value is printed and the exit status is one. """ + if _opts.killwithsigquit: + _send_sigquit() + # import traceback # traceback.print_stack() p, _ = _currentSubprocess @@ -4076,6 +4079,8 @@ abort(1) signal.signal(signal.SIGTERM, term_handler) + def quit_handler(signum, frame): + _send_sigquit() signal.signal(signal.SIGQUIT, quit_handler) try: