Skip to content

Commit f7c59ec

Browse files
authored
fix(bundler): support macOS 10.13.6+ on notarization, closes #4549 (#4593)
1 parent b8cd2a7 commit f7c59ec

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

.changes/fix-notarization-stdout-parse.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"tauri-bundler": patch
33
---
44

5-
Ensure the notarization `RequestUUID` and `Status` parser works even if the altool output does not have a newline after it.
5+
Ensure the notarization `RequestUUID` and `Status` parser works on macOS 10.13.6+.

tooling/bundler/src/bundle/macos/sign.rs

+19-10
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,13 @@ pub fn notarize(
275275
.output_ok()
276276
.context("failed to upload app to Apple's notarization servers.")?;
277277

278-
let mut stdout = std::str::from_utf8(&output.stdout)?.to_string();
279-
stdout.push('\n');
278+
// combine both stdout and stderr to support macOS below 10.15
279+
let mut notarize_response = std::str::from_utf8(&output.stdout)?.to_string();
280+
notarize_response.push('\n');
281+
notarize_response.push_str(std::str::from_utf8(&output.stderr)?);
282+
notarize_response.push('\n');
280283
if let Some(uuid) = Regex::new(r"\nRequestUUID = (.+?)\n")?
281-
.captures_iter(&stdout)
284+
.captures_iter(&notarize_response)
282285
.next()
283286
{
284287
info!("notarization started; waiting for Apple response...");
@@ -288,7 +291,11 @@ pub fn notarize(
288291
staple_app(app_bundle_path.clone())?;
289292
} else {
290293
return Err(
291-
anyhow::anyhow!("failed to parse RequestUUID from upload output. {}", stdout).into(),
294+
anyhow::anyhow!(
295+
"failed to parse RequestUUID from upload output. {}",
296+
notarize_response
297+
)
298+
.into(),
292299
);
293300
}
294301

@@ -326,10 +333,13 @@ fn get_notarization_status(
326333
.output_ok();
327334

328335
if let Ok(output) = result {
329-
let mut stdout = std::str::from_utf8(&output.stdout)?.to_string();
330-
stdout.push('\n');
336+
// combine both stdout and stderr to support macOS below 10.15
337+
let mut notarize_status = std::str::from_utf8(&output.stdout)?.to_string();
338+
notarize_status.push('\n');
339+
notarize_status.push_str(std::str::from_utf8(&output.stderr)?);
340+
notarize_status.push('\n');
331341
if let Some(status) = Regex::new(r"\n *Status: (.+?)\n")?
332-
.captures_iter(&stdout)
342+
.captures_iter(&notarize_status)
333343
.next()
334344
{
335345
let status = status[1].to_string();
@@ -339,16 +349,15 @@ fn get_notarization_status(
339349
Err(
340350
anyhow::anyhow!(format!(
341351
"Apple failed to notarize your app. {}",
342-
std::str::from_utf8(&output.stdout)?
352+
notarize_status
343353
))
344354
.into(),
345355
)
346356
} else if status != "success" {
347357
Err(
348358
anyhow::anyhow!(format!(
349359
"Unknown notarize status {}. {}",
350-
status,
351-
std::str::from_utf8(&output.stdout)?
360+
status, notarize_status
352361
))
353362
.into(),
354363
)

0 commit comments

Comments
 (0)