aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/commandrunner.py
diff options
context:
space:
mode:
authorbehlec <33778676+behlec@users.noreply.github.com>2017-12-09 00:52:13 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2017-12-09 01:52:13 +0200
commit4217a9ca7ebb8c58f55e937aaf81e9e637588d63 (patch)
tree9b6915983ed4305237325bdd2812373645e83156 /mesonbuild/scripts/commandrunner.py
parent8d795a84036e7aa2da88f2ca76bd50459d4a0bae (diff)
downloadmeson-4217a9ca7ebb8c58f55e937aaf81e9e637588d63.zip
meson-4217a9ca7ebb8c58f55e937aaf81e9e637588d63.tar.gz
meson-4217a9ca7ebb8c58f55e937aaf81e9e637588d63.tar.bz2
Check for more errors when executing subprocess. (#2746)
Diffstat (limited to 'mesonbuild/scripts/commandrunner.py')
-rw-r--r--mesonbuild/scripts/commandrunner.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/mesonbuild/scripts/commandrunner.py b/mesonbuild/scripts/commandrunner.py
index fdca7cd..fc65e5b 100644
--- a/mesonbuild/scripts/commandrunner.py
+++ b/mesonbuild/scripts/commandrunner.py
@@ -31,10 +31,9 @@ def run_command(source_dir, build_dir, subdir, meson_command, command, arguments
exe = shutil.which(command)
if exe is not None:
command_array = [exe] + arguments
- return subprocess.Popen(command_array, env=child_env, cwd=cwd)
- # No? Maybe it is a script in the source tree.
- fullpath = os.path.join(source_dir, subdir, command)
- command_array = [fullpath] + arguments
+ else:# No? Maybe it is a script in the source tree.
+ fullpath = os.path.join(source_dir, subdir, command)
+ command_array = [fullpath] + arguments
try:
return subprocess.Popen(command_array, env=child_env, cwd=cwd)
except FileNotFoundError:
@@ -43,6 +42,13 @@ def run_command(source_dir, build_dir, subdir, meson_command, command, arguments
except PermissionError:
print('Could not execute command "%s". File not executable.' % command)
sys.exit(1)
+ except OSError as err:
+ print('Could not execute command "{}": {}'.format(command, err))
+ sys.exit(1)
+ except subprocess.SubprocessError as err:
+ print('Could not execute command "{}": {}'.format(command, err))
+ sys.exit(1)
+
def run(args):
if len(args) < 4: