From 1ec7d0bb87fd55738430bbbd0875621c70cce841 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 20 Jun 2024 14:26:12 +0800 Subject: [PATCH] Make codesigning throw in mac crafter Signed-off-by: Claudio Cambra --- admin/osx/mac-crafter/Sources/Utils/Codesign.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift index 78ea5af2e..e0d5e5cbf 100644 --- a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift +++ b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift @@ -14,15 +14,18 @@ import Foundation +enum CodeSigningError: Error { + case failedToCodeSign(String) +} + func codesign( identity: String, path: String, options: String = "--timestamp --force --preserve-metadata=entitlements --verbose=4 --options runtime" -) { +) throws { print("Code-signing \(path)...") let command = "codesign -s \"\(identity)\" \(options) \(path)" guard shell(command) == 0 else { - print("Failed to code-sign \(path).") - exit(1) + throw CodeSigningError.failedToCodeSign("Failed to code-sign \(path).") } } -- 2.30.2