Wait and check for exit code when running 'patch'

This commit is contained in:
Ignacio Etcheverry 2020-04-06 14:51:14 +02:00
parent 443ca3c7e1
commit 27b5523a2d
2 changed files with 14 additions and 2 deletions

View File

@ -28,8 +28,14 @@ def main(raw_args):
] ]
from subprocess import Popen from subprocess import Popen
from sys import exit
for patch in patches: 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__': if __name__ == '__main__':

View File

@ -33,8 +33,14 @@ def main(raw_args):
] ]
from subprocess import Popen from subprocess import Popen
from sys import exit
for patch in patches: 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__': if __name__ == '__main__':