From 27b5523a2d93d84d3472a8feec0df650d5f5f0b9 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Mon, 6 Apr 2020 14:51:14 +0200 Subject: [PATCH] Wait and check for exit code when running 'patch' --- patch_emscripten.py | 8 +++++++- patch_mono.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/patch_emscripten.py b/patch_emscripten.py index bce6720..56f3cef 100755 --- a/patch_emscripten.py +++ b/patch_emscripten.py @@ -28,8 +28,14 @@ def main(raw_args): ] from subprocess import Popen + from sys import exit for patch in patches: - proc = Popen('bash -c \'patch -N -p1 < %s; exit 0\'' % patch, cwd=emsdk_root, shell=True) + patch_cmd = 'patch -N -p1 < %s' % patch + print('Running: %s' % patch_cmd) + proc = Popen('bash -c \'%s; exit $?\'' % patch_cmd, cwd=emsdk_root, shell=True) + exit_code = proc.wait() + if exit_code != 0: + exit('patch exited with error code: %s' % exit_code) if __name__ == '__main__': diff --git a/patch_mono.py b/patch_mono.py index 6c42672..c58bb14 100755 --- a/patch_mono.py +++ b/patch_mono.py @@ -33,8 +33,14 @@ def main(raw_args): ] from subprocess import Popen + from sys import exit for patch in patches: - proc = Popen('bash -c \'patch -N -p1 < %s; exit 0\'' % os.path.join(patches_dir, patch), cwd=mono_source_root, shell=True) + patch_cmd = 'patch -N -p1 < %s' % os.path.join(patches_dir, patch) + print('Running: %s' % patch_cmd) + proc = Popen('bash -c \'%s; exit $?\'' % patch_cmd, cwd=mono_source_root, shell=True) + exit_code = proc.wait() + if exit_code != 0: + exit('patch exited with error code: %s' % exit_code) if __name__ == '__main__':