@@ -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+
4454export 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