changeset 14135:ee66410c0679

mx: add option to send sigquit before killing child
author Bernhard Urban <bernhard.urban@jku.at>
date Tue, 11 Mar 2014 17:48:21 +0100
parents e71d421370f3
children 38c0db058dcd
files mxtool/mx.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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='<path>', default=os.path.expanduser('~'))
         self.add_argument('--java-home', help='bootstrap JDK installation directory (must be JDK 6 or later)', metavar='<path>')
         self.add_argument('--ignore-project', action='append', dest='ignored_projects', help='name of project to ignore', metavar='<name>', 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='<secs>')
@@ -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: