comparison mxtool/mx.py @ 4396:4023bae16d02

Make mx script killable on Windows. renamed mx.bat to mx.cmd.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 28 Jan 2012 23:14:46 +0100
parents 8dd27e218e19
children 7903b6c28f9c
comparison
equal deleted inserted replaced
4395:a8a54134ede2 4396:4023bae16d02
590 590
591 if not callable(out) and not callable(err) and timeout is None: 591 if not callable(out) and not callable(err) and timeout is None:
592 # The preexec_fn=os.setsid 592 # The preexec_fn=os.setsid
593 p = subprocess.Popen(args, cwd=cwd, preexec_fn=preexec_fn, creationflags=creationflags) 593 p = subprocess.Popen(args, cwd=cwd, preexec_fn=preexec_fn, creationflags=creationflags)
594 _currentSubprocess = (p, args) 594 _currentSubprocess = (p, args)
595 retcode = p.wait() 595 if get_os() == 'windows':
596 # on windows use a poll loop, otherwise signal does not get handled
597 retcode = None
598 while retcode == None:
599 retcode = p.poll()
600 time.sleep(0.05)
601 else:
602 retcode = p.wait()
596 else: 603 else:
597 def redirect(stream, f): 604 def redirect(stream, f):
598 for line in iter(stream.readline, ''): 605 for line in iter(stream.readline, ''):
599 f(line) 606 f(line)
600 stream.close() 607 stream.close()