changeset 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 a8a54134ede2
children 403330cfd3da
files mx.bat mx.cmd mxtool/mx.py
diffstat 3 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mx.bat	Sat Jan 28 22:27:36 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-python mxtool/mx.py %*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mx.cmd	Sat Jan 28 23:14:46 2012 +0100
@@ -0,0 +1,1 @@
+python mxtool/mx.py %*
--- a/mxtool/mx.py	Sat Jan 28 22:27:36 2012 +0100
+++ b/mxtool/mx.py	Sat Jan 28 23:14:46 2012 +0100
@@ -592,7 +592,14 @@
             # The preexec_fn=os.setsid
             p = subprocess.Popen(args, cwd=cwd, preexec_fn=preexec_fn, creationflags=creationflags)
             _currentSubprocess = (p, args)
-            retcode = p.wait()
+            if get_os() == 'windows':
+                # on windows use a poll loop, otherwise signal does not get handled
+                retcode = None
+                while retcode == None:
+                    retcode = p.poll()
+                    time.sleep(0.05)
+            else:
+                retcode = p.wait()            
         else:
             def redirect(stream, f):
                 for line in iter(stream.readline, ''):