From 8d421c1ff6be50869454b23afe2368ef0967432a Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Wed, 26 Apr 2023 09:22:02 -0400 Subject: [PATCH] If there is an error, stop the signing process. --- cmake/sign_dmg.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/cmake/sign_dmg.py b/cmake/sign_dmg.py index 69e74779..71cdeabc 100644 --- a/cmake/sign_dmg.py +++ b/cmake/sign_dmg.py @@ -39,16 +39,23 @@ def sign_dmg(input_dmg, output_dmg, signing_identity): exit(1) # Sign the .app bundle - subprocess.run([ - 'codesign', - '--deep', - '--force', - '--verbose', - '--options', 'runtime', - '--timestamp', - '--sign', signing_identity, - app_bundle - ]) + try: + subprocess.run([ + 'codesign', + '--deep', + '--force', + '--verbose', + '--options', 'runtime', + '--timestamp', + '--sign', signing_identity, + app_bundle + ], check=True) + except subprocess.CalledProcessError as e: + print(f"Error during codesign: {e}") + # Clean up temporary directories + shutil.rmtree(temp_dir) + shutil.rmtree(mount_point) + exit(1) # Create a new DMG containing the signed .app bundle subprocess.run([