comparison mxtool/mx.py @ 4248:c580db4d6f6f

fix mx.py for windows
author Andreas Woess <andreas.woess@jku.at>
date Mon, 09 Jan 2012 14:21:54 +0100
parents 3f6c6e61614e
children 67e88b7624d5
comparison
equal deleted inserted replaced
4247:3f6c6e61614e 4248:c580db4d6f6f
566 assert isinstance(arg, types.StringTypes), 'argument is not a string: ' + str(arg) 566 assert isinstance(arg, types.StringTypes), 'argument is not a string: ' + str(arg)
567 567
568 if _opts.verbose: 568 if _opts.verbose:
569 log(' '.join(args)) 569 log(' '.join(args))
570 570
571 if timeout is None and _opts.ptimeout != 0: 571 if timeout is None and hasattr(_opts, 'ptimeout') and _opts.ptimeout != 0:
572 timeout = _opts.ptimeout 572 timeout = _opts.ptimeout
573 573
574 global _currentSubprocess 574 global _currentSubprocess
575 575
576 try: 576 try:
1247 if not commands.has_key(command): 1247 if not commands.has_key(command):
1248 abort('mx: unknown command \'{0}\'\n{1}use "mx help" for more options'.format(command, _format_commands())) 1248 abort('mx: unknown command \'{0}\'\n{1}use "mx help" for more options'.format(command, _format_commands()))
1249 1249
1250 c, _ = commands[command][:2] 1250 c, _ = commands[command][:2]
1251 try: 1251 try:
1252 if opts.timeout != 0: 1252 if hasattr(opts, 'timeout') and opts.timeout != 0:
1253 def alarm_handler(signum, frame): 1253 def alarm_handler(signum, frame):
1254 abort('Command timed out after ' + str(opts.timeout) + ' seconds: ' + ' '.join(commandAndArgs)) 1254 abort('Command timed out after ' + str(opts.timeout) + ' seconds: ' + ' '.join(commandAndArgs))
1255 signal.signal(signal.SIGALRM, alarm_handler) 1255 signal.signal(signal.SIGALRM, alarm_handler)
1256 signal.alarm(opts.timeout) 1256 signal.alarm(opts.timeout)
1257 retcode = c(command_args) 1257 retcode = c(command_args)