1
0
Fork 0

improved error handling for arc patch

This commit is contained in:
Christian Kühnel 2019-11-18 16:36:23 +01:00
parent 608062e08c
commit d028ac35b1

View file

@ -50,7 +50,7 @@ def _git_checkout(git_hash: str):
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
print('WARNING: checkout of hash failed, using master branch instead.') print('WARNING: checkout of hash failed, using master branch instead.')
subprocess.check_call('git checkout master', stdout=sys.stdout, stderr=sys.stderr, subprocess.check_call('git checkout master', stdout=sys.stdout, stderr=sys.stderr,
shell=True) shell=True)
print('git checkout completed.') print('git checkout completed.')
@ -59,10 +59,11 @@ def _apply_patch(diff_id: str, conduit_token: str, host: str):
cmd = 'arc patch --nobranch --no-ansi --diff "{}" --nocommit '\ cmd = 'arc patch --nobranch --no-ansi --diff "{}" --nocommit '\
'--conduit-token "{}" --conduit-uri "{}"'.format( '--conduit-token "{}" --conduit-uri "{}"'.format(
diff_id, conduit_token, host ) diff_id, conduit_token, host )
try: result = subprocess.run(cmd, capture_output=True, stderr=subprocess.STDOUT,
subprocess.check_call(cmd, stdout=sys.stdout, stderr=sys.stderr, shell=True) shell=True, text=True)
except subprocess.CalledProcessError: if result.returncode != 0:
print('arc patch failed!') print('ERROR: arc patch failed with error code {} and message:'.format(result.returncode))
print(result.stdout + result.stderr)
raise raise
print('Patching completed.') print('Patching completed.')