Skip to content

Commit dfbdcd8

Browse files
authored
feat: add notarization logs to debug logging for success (#202)
1 parent a38ba02 commit dfbdcd8

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/notarytool.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ function authorizationArgs(rawOpts: NotaryToolCredentials): string[] {
4141
}
4242
}
4343

44+
async function getNotarizationLogs(opts: NotaryToolStartOptions, id: string) {
45+
try {
46+
const logResult = await spawn('xcrun', ['notarytool', 'log', id, ...authorizationArgs(opts)]);
47+
d('notarization log', logResult.output);
48+
return logResult.output;
49+
} catch (e) {
50+
d('failed to pull notarization logs', e);
51+
}
52+
}
53+
4454
export async function isNotaryToolAvailable() {
4555
const result = await spawn('xcrun', ['--find', 'notarytool']);
4656
return result.code === 0;
@@ -94,25 +104,14 @@ export async function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions)
94104
);
95105
}
96106

97-
if (result.code === 0 && parsed.status === 'Accepted') {
98-
d('notarization success');
99-
return;
107+
let logOutput: undefined | string;
108+
if (typeof parsed.id === 'string') {
109+
logOutput = await getNotarizationLogs(opts, parsed.id);
100110
}
101111

102-
let logOutput: undefined | string;
103-
if (parsed.id) {
104-
try {
105-
const logResult = await spawn('xcrun', [
106-
'notarytool',
107-
'log',
108-
parsed.id,
109-
...authorizationArgs(opts),
110-
]);
111-
d('notarization log', logResult.output);
112-
logOutput = logResult.output;
113-
} catch (e) {
114-
d('failed to pull notarization logs', e);
115-
}
112+
if (result.code === 0 && parsed.status === 'Accepted') {
113+
d(`notarization success (id: ${parsed.id})`);
114+
return;
116115
}
117116

118117
let message = `Failed to notarize via notarytool\n\n${result.output}`;

0 commit comments

Comments
 (0)