diff options
Diffstat (limited to 'mesonbuild/backend')
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index e11491f..c95ee18 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -18,7 +18,7 @@ from .. import build from .. import mlog from .. import dependencies from .. import compilers -from ..mesonlib import File, MesonException, get_compiler_for_source +from ..mesonlib import File, MesonException, get_compiler_for_source, Popen_safe from .backends import InstallData from ..build import InvalidArguments import os, sys, pickle, re @@ -159,18 +159,14 @@ class NinjaBackend(backends.Backend): int dummy; ''') - pc = subprocess.Popen(['cl', '/showIncludes', '/c', 'incdetect.c'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - cwd=self.environment.get_scratch_dir()) + pc, stdo = Popen_safe(['cl', '/showIncludes', '/c', 'incdetect.c'], + cwd=self.environment.get_scratch_dir())[0:2] - (stdo, _) = pc.communicate() - - for line in stdo.split(b'\r\n'): - if line.endswith(b'stdio.h'): - matchstr = b':'.join(line.split(b':')[0:2]) + b':' - with open(tempfilename, 'ab') as binfile: - binfile.write(b'msvc_deps_prefix = ' + matchstr + b'\r\n') + for line in stdo.split('\n'): + if line.endswith('stdio.h'): + matchstr = ':'.join(line.split(':')[0:2]) + ':' + with open(tempfilename, 'a') as binfile: + binfile.write('msvc_deps_prefix = ' + matchstr + '\n') return open(tempfilename, 'a') raise MesonException('Could not determine vs dep dependency prefix string.') |