changeset 18930:9aa1cff041eb

fix in mx.py, MX_SUBPROCESS_COMMAND_FILE opened twice, fails on Windows
author Christian Wirth <christian.wirth@oracle.com>
date Fri, 23 Jan 2015 12:08:12 +0100
parents 8f2fb6bec986
children 926488f5d345
files mxtool/mx.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Fri Jan 23 10:54:21 2015 +0100
+++ b/mxtool/mx.py	Fri Jan 23 12:08:12 2015 +0100
@@ -1881,8 +1881,8 @@
     # variable. However, since environment variables share the same resource
     # space as the command line itself (on Unix at least), this would cause the
     # limit to be exceeded too easily.
-    _, subprocessCommandFile = tempfile.mkstemp(suffix='', prefix='mx_subprocess_command.')
-    with open(subprocessCommandFile, 'w') as fp:
+    with tempfile.NamedTemporaryFile(suffix='', prefix='mx_subprocess_command.', mode='w', delete=False) as fp:
+        subprocessCommandFile = fp.name
         for arg in args:
             # TODO: handle newlines in args once there's a use case
             assert '\n' not in arg