diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-21 04:48:56 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-07-17 19:20:00 +0300 |
commit | afdaedea01e372ab783477e6f2ce0ca81797be07 (patch) | |
tree | 240ee8245de053f55dbc6b9f6dfbc50c434ff719 | |
parent | 37057abfefcc77be5d5350928421ae24e8b621af (diff) | |
download | meson-afdaedea01e372ab783477e6f2ce0ca81797be07.zip meson-afdaedea01e372ab783477e6f2ce0ca81797be07.tar.gz meson-afdaedea01e372ab783477e6f2ce0ca81797be07.tar.bz2 |
msvc: Split stderr by line and raise exception if empty
std.split() splits on whitespace, but we want the first line.
-rw-r--r-- | mesonbuild/environment.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index ed5a216..29ff19e 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -537,7 +537,10 @@ class Environment: # Visual Studio prints version number to stderr but # everything else to stdout. Why? Lord only knows. version = search_version(err) - is_64 = err.split()[0].endswith(' x64') + if not err or not err.split('\n')[0]: + m = 'Failed to detect MSVC compiler arch: stderr was\n{!r}' + raise EnvironmentException(m.format(err)) + is_64 = err.split('\n')[0].endswith(' x64') cls = VisualStudioCCompiler if lang == 'c' else VisualStudioCPPCompiler return cls(compiler, version, is_cross, exe_wrap, is_64) if '(ICC)' in out: |