From 5e5aebffd39dfeeba60dcbcc2f9f74b193574c51 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 28 Dec 2020 15:35:45 -0800 Subject: [PATCH] Reduce code duplication by using SUAdHocCodeSigning --- Tests/SUCodeSigningVerifierTest.m | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Tests/SUCodeSigningVerifierTest.m b/Tests/SUCodeSigningVerifierTest.m index fd5a3021..bf1377bd 100644 --- a/Tests/SUCodeSigningVerifierTest.m +++ b/Tests/SUCodeSigningVerifierTest.m @@ -9,6 +9,7 @@ #import #import #import "SUCodeSigningVerifier.h" +#import "SUAdHocCodeSigning.h" #import "SUFileManager.h" #if defined(__MAC_10_15) @@ -182,21 +183,7 @@ - (BOOL)codesignAppURL:(NSURL *)appURL { - BOOL success = NO; - @try - { - // ad-hoc signing with the dash - NSString *appPath = [appURL path]; - NSArray *arguments = @[ @"--force", @"--deep", @"--sign", @"-", appPath ]; - NSTask *task = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/codesign" arguments:arguments]; - [task waitUntilExit]; - success = (task.terminationStatus == 0); - } - @catch (NSException *exception) - { - NSLog(@"exception: %@", exception); - } - return success; + return [SUAdHocCodeSigning codeSignApplicationAtPath:appURL.path]; } - (void)testUnsignedApp