diff --git a/.changes/fix-notarization-stdout-parse.md b/.changes/fix-notarization-stdout-parse.md index ab3b33bf0..8582ef43a 100644 --- a/.changes/fix-notarization-stdout-parse.md +++ b/.changes/fix-notarization-stdout-parse.md @@ -2,4 +2,4 @@ "tauri-bundler": patch --- -Ensure the notarization `RequestUUID` and `Status` parser works even if the altool output does not have a newline after it. +Ensure the notarization `RequestUUID` and `Status` parser works on macOS 10.13.6+. diff --git a/tooling/bundler/src/bundle/macos/sign.rs b/tooling/bundler/src/bundle/macos/sign.rs index c97604bc0..9346f3ade 100644 --- a/tooling/bundler/src/bundle/macos/sign.rs +++ b/tooling/bundler/src/bundle/macos/sign.rs @@ -275,10 +275,13 @@ pub fn notarize( .output_ok() .context("failed to upload app to Apple's notarization servers.")?; - let mut stdout = std::str::from_utf8(&output.stdout)?.to_string(); - stdout.push('\n'); + // combine both stdout and stderr to support macOS below 10.15 + let mut notarize_response = std::str::from_utf8(&output.stdout)?.to_string(); + notarize_response.push('\n'); + notarize_response.push_str(std::str::from_utf8(&output.stderr)?); + notarize_response.push('\n'); if let Some(uuid) = Regex::new(r"\nRequestUUID = (.+?)\n")? - .captures_iter(&stdout) + .captures_iter(¬arize_response) .next() { info!("notarization started; waiting for Apple response..."); @@ -288,7 +291,11 @@ pub fn notarize( staple_app(app_bundle_path.clone())?; } else { return Err( - anyhow::anyhow!("failed to parse RequestUUID from upload output. {}", stdout).into(), + anyhow::anyhow!( + "failed to parse RequestUUID from upload output. {}", + notarize_response + ) + .into(), ); } @@ -326,10 +333,13 @@ fn get_notarization_status( .output_ok(); if let Ok(output) = result { - let mut stdout = std::str::from_utf8(&output.stdout)?.to_string(); - stdout.push('\n'); + // combine both stdout and stderr to support macOS below 10.15 + let mut notarize_status = std::str::from_utf8(&output.stdout)?.to_string(); + notarize_status.push('\n'); + notarize_status.push_str(std::str::from_utf8(&output.stderr)?); + notarize_status.push('\n'); if let Some(status) = Regex::new(r"\n *Status: (.+?)\n")? - .captures_iter(&stdout) + .captures_iter(¬arize_status) .next() { let status = status[1].to_string(); @@ -339,7 +349,7 @@ fn get_notarization_status( Err( anyhow::anyhow!(format!( "Apple failed to notarize your app. {}", - std::str::from_utf8(&output.stdout)? + notarize_status )) .into(), ) @@ -347,8 +357,7 @@ fn get_notarization_status( Err( anyhow::anyhow!(format!( "Unknown notarize status {}. {}", - status, - std::str::from_utf8(&output.stdout)? + status, notarize_status )) .into(), )