diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-05-18 17:13:15 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-05-18 17:13:15 +0300 |
commit | 547706e385fa259d88550c51c5c74545ab0c7b8c (patch) | |
tree | 710471ad7286080a3d9a96a222e2ad1575728094 /environment.py | |
parent | 5eba6247772a4b1086000ce377481fd16128dd16 (diff) | |
download | meson-547706e385fa259d88550c51c5c74545ab0c7b8c.zip meson-547706e385fa259d88550c51c5c74545ab0c7b8c.tar.gz meson-547706e385fa259d88550c51c5c74545ab0c7b8c.tar.bz2 |
Close temporary file because poor little Windows can't handle a file
being opened multiple times.
Diffstat (limited to 'environment.py')
-rwxr-xr-x | environment.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/environment.py b/environment.py index 11274db..e6c25aa 100755 --- a/environment.py +++ b/environment.py @@ -112,13 +112,15 @@ class CCompiler(): def compiles(self, code): suflen = len(self.default_suffix) (fd, srcname) = tempfile.mkstemp(suffix='.'+self.default_suffix) - open(srcname, 'w').write(code) + os.close(fd) + ofile = open(srcname, 'w') + ofile.write(code) + ofile.close() commands = self.get_exelist() commands += self.get_compile_only_flags() commands.append(srcname) p = subprocess.Popen(commands, cwd=os.path.split(srcname)[0], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) p.communicate() - os.close(fd) os.remove(srcname) try: trial = srcname[:-suflen] + 'o' |