diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-02-10 15:12:21 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-02-10 15:12:21 +0200 |
commit | c3b599167f9dcf8b8b6e493c8e51ebaacf6b9802 (patch) | |
tree | 370a9f1fc3e1bdc67b642c4bca9479998c3b676a /environment.py | |
parent | 727562fbd899e0d20bd3a4a9fd178e58db0928cd (diff) | |
download | meson-c3b599167f9dcf8b8b6e493c8e51ebaacf6b9802.zip meson-c3b599167f9dcf8b8b6e493c8e51ebaacf6b9802.tar.gz meson-c3b599167f9dcf8b8b6e493c8e51ebaacf6b9802.tar.bz2 |
Guard against invalid compiler command line.
Diffstat (limited to 'environment.py')
-rwxr-xr-x | environment.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/environment.py b/environment.py index 637b280..6dd775b 100755 --- a/environment.py +++ b/environment.py @@ -222,7 +222,10 @@ class Environment(): def detect_c_compiler(self): exelist = self.get_c_compiler_exelist() - p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE) + try: + p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE) + except OSError: + raise EnvironmentException('Could not execute C compiler "%s"' % ' '.join(exelist)) out = p.communicate()[0] out = out.decode() if (out.startswith('cc ') or out.startswith('gcc')) and \ @@ -241,7 +244,10 @@ class Environment(): def detect_cxx_compiler(self): exelist = self.get_cxx_compiler_exelist() - p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE) + try: + p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE) + except OSError: + raise EnvironmentException('Could not execute C++ compiler "%s"' % ' '.join(exelist)) out = p.communicate()[0] out = out.decode() if (out.startswith('c++ ') or out.startswith('g++')) and \ |