diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-08-05 12:08:50 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-08-05 12:08:50 +0300 |
commit | 4119859c3d20231a5a2592e5d0be756cf978cdc9 (patch) | |
tree | cd1e6fa4f9189cff6ab4a511b7e44e48b97d6d94 /environment.py | |
parent | cf6a395014c1927f1e2c66d0f724d636d3e1fa55 (diff) | |
download | meson-4119859c3d20231a5a2592e5d0be756cf978cdc9.zip meson-4119859c3d20231a5a2592e5d0be756cf978cdc9.tar.gz meson-4119859c3d20231a5a2592e5d0be756cf978cdc9.tar.bz2 |
Run VS in inside temp dir so it does not leak files around.
Diffstat (limited to 'environment.py')
-rw-r--r-- | environment.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/environment.py b/environment.py index 8bff475..bd9a745 100644 --- a/environment.py +++ b/environment.py @@ -894,18 +894,19 @@ class VisualStudioCCompiler(CCompiler): return (objname, ['/Yc' + header, '/Fp' + pchname, '/Fo' + objname ]) def sanity_check(self, work_dir): - source_name = os.path.join(work_dir, 'sanitycheckc.c') - binary_name = os.path.join(work_dir, 'sanitycheckc') - ofile = open(source_name, 'w') + source_name = 'sanitycheckc.c' + binary_name = 'sanitycheckc' + ofile = open(os.path.join(work_dir, source_name), 'w') ofile.write('int main(int argc, char **argv) { return 0; }\n') ofile.close() pc = subprocess.Popen(self.exelist + [source_name, '/Fe' + binary_name], stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + stderr=subprocess.DEVNULL, + cwd=work_dir) pc.wait() if pc.returncode != 0: raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string()) - pe = subprocess.Popen(binary_name) + pe = subprocess.Popen(os.path.join(work_dir, binary_name)) pe.wait() if pe.returncode != 0: raise EnvironmentException('Executables created by C++ compiler %s are not runnable.' % self.name_string()) @@ -923,18 +924,19 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler): return False def sanity_check(self, work_dir): - source_name = os.path.join(work_dir, 'sanitycheckcpp.cpp') - binary_name = os.path.join(work_dir, 'sanitycheckcpp') - ofile = open(source_name, 'w') + source_name = 'sanitycheckcpp.cpp' + binary_name = 'sanitycheckcpp' + ofile = open(os.path.join(work_dir, source_name), 'w') ofile.write('class BreakPlainC;int main(int argc, char **argv) { return 0; }\n') ofile.close() pc = subprocess.Popen(self.exelist + [source_name, '/Fe' + binary_name], stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + stderr=subprocess.DEVNULL, + cwd=work_dir) pc.wait() if pc.returncode != 0: raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string()) - pe = subprocess.Popen(binary_name) + pe = subprocess.Popen(os.path.join(work_dir, binary_name)) pe.wait() if pe.returncode != 0: raise EnvironmentException('Executables created by C++ compiler %s are not runnable.' % self.name_string()) |