comparison mxtool/mx.py @ 4312:8dd27e218e19

Merge
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 19 Jan 2012 19:06:25 +0100
parents fad6f1ebeb44 d4906ea4255b
children 4023bae16d02
comparison
equal deleted inserted replaced
4311:8e2c4affcd51 4312:8dd27e218e19
574 log(' '.join(args)) 574 log(' '.join(args))
575 575
576 if timeout is None and _opts.ptimeout != 0: 576 if timeout is None and _opts.ptimeout != 0:
577 timeout = _opts.ptimeout 577 timeout = _opts.ptimeout
578 578
579 global _currentSubprocess 579 global _currentSubprocess
580 580
581 try: 581 try:
582 # On Unix, the new subprocess should be in a separate group so that a timeout alarm 582 # On Unix, the new subprocess should be in a separate group so that a timeout alarm
583 # can use os.killpg() to kill the whole subprocess group 583 # can use os.killpg() to kill the whole subprocess group
584 preexec_fn = None 584 preexec_fn = None
1627 1627
1628 if not commands.has_key(command): 1628 if not commands.has_key(command):
1629 abort('mx: unknown command \'{0}\'\n{1}use "mx help" for more options'.format(command, _format_commands())) 1629 abort('mx: unknown command \'{0}\'\n{1}use "mx help" for more options'.format(command, _format_commands()))
1630 1630
1631 c, _ = commands[command][:2] 1631 c, _ = commands[command][:2]
1632 def term_handler(signum, frame):
1633 abort(1)
1634 signal.signal(signal.SIGTERM, term_handler)
1632 try: 1635 try:
1633 if opts.timeout != 0: 1636 if opts.timeout != 0:
1634 def alarm_handler(signum, frame): 1637 def alarm_handler(signum, frame):
1635 abort('Command timed out after ' + str(opts.timeout) + ' seconds: ' + ' '.join(commandAndArgs)) 1638 abort('Command timed out after ' + str(opts.timeout) + ' seconds: ' + ' '.join(commandAndArgs))
1636 signal.signal(signal.SIGALRM, alarm_handler) 1639 signal.signal(signal.SIGALRM, alarm_handler)