comparison mxtool/mx.py @ 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 7e500c20208c
children 258b3658845a
comparison
equal deleted inserted replaced
18929:8f2fb6bec986 18930:9aa1cff041eb
1879 1879
1880 # Ideally the command line could be communicated directly in an environment 1880 # Ideally the command line could be communicated directly in an environment
1881 # variable. However, since environment variables share the same resource 1881 # variable. However, since environment variables share the same resource
1882 # space as the command line itself (on Unix at least), this would cause the 1882 # space as the command line itself (on Unix at least), this would cause the
1883 # limit to be exceeded too easily. 1883 # limit to be exceeded too easily.
1884 _, subprocessCommandFile = tempfile.mkstemp(suffix='', prefix='mx_subprocess_command.') 1884 with tempfile.NamedTemporaryFile(suffix='', prefix='mx_subprocess_command.', mode='w', delete=False) as fp:
1885 with open(subprocessCommandFile, 'w') as fp: 1885 subprocessCommandFile = fp.name
1886 for arg in args: 1886 for arg in args:
1887 # TODO: handle newlines in args once there's a use case 1887 # TODO: handle newlines in args once there's a use case
1888 assert '\n' not in arg 1888 assert '\n' not in arg
1889 print >> fp, arg 1889 print >> fp, arg
1890 env['MX_SUBPROCESS_COMMAND_FILE'] = subprocessCommandFile 1890 env['MX_SUBPROCESS_COMMAND_FILE'] = subprocessCommandFile