# HG changeset patch # User Gilles Duboscq # Date 1326901984 -3600 # Node ID d4906ea4255b9f062c4691cc954317e16940b16d # Parent 48cbd78fa964c89a5733aa35827bbe032e673499 Handle SIGTERM : killing mx will properly kill subprocesses Some tabs/spaces mixups diff -r 48cbd78fa964 -r d4906ea4255b mx/commands.py --- a/mx/commands.py Tue Jan 17 19:38:48 2012 -0800 +++ b/mx/commands.py Wed Jan 18 16:53:04 2012 +0100 @@ -516,8 +516,8 @@ index = args.index('-resultfile') if index + 1 < len(args): resultFile = args[index + 1] - del args[index] - del args[index] + del args[index] + del args[index] else: mx.abort('-resultfile must be followed by a file name') vm = 'graal' @@ -526,7 +526,7 @@ if index + 1 < len(args): vm = args[index + 1] del args[index] - del args[index] + del args[index] else: mx.abort('-vm must be followed by a vm name (graal, server, client..)') if len(args) is 0: diff -r 48cbd78fa964 -r d4906ea4255b mxtool/mx.py --- a/mxtool/mx.py Tue Jan 17 19:38:48 2012 -0800 +++ b/mxtool/mx.py Wed Jan 18 16:53:04 2012 +0100 @@ -576,7 +576,7 @@ if timeout is None and _opts.ptimeout != 0: timeout = _opts.ptimeout - global _currentSubprocess + global _currentSubprocess try: # On Unix, the new subprocess should be in a separate group so that a timeout alarm @@ -1618,6 +1618,9 @@ abort('mx: unknown command \'{0}\'\n{1}use "mx help" for more options'.format(command, _format_commands())) c, _ = commands[command][:2] + def term_handler(signum, frame): + abort(1) + signal.signal(signal.SIGTERM, term_handler) try: if opts.timeout != 0: def alarm_handler(signum, frame):