Ver código fonte

fix(bundler): ensure RequestUUID and Status parser adds a \n, closes #4549 (#4559)

Lucas Fernandes Nogueira 3 anos atrás
pai
commit
23d3d847d1

+ 5 - 0
.changes/fix-notarization-stdout-parse.md

@@ -0,0 +1,5 @@
+---
+"tauri-bundler": patch
+---
+
+Ensure the notarization `RequestUUID` and `Status` parser works even if the altool output does not have a newline after it.

+ 6 - 4
tooling/bundler/src/bundle/macos/sign.rs

@@ -275,9 +275,10 @@ pub fn notarize(
     .output_ok()
     .context("failed to upload app to Apple's notarization servers.")?;
 
-  let stdout = std::str::from_utf8(&output.stdout)?;
+  let mut stdout = std::str::from_utf8(&output.stdout)?.to_string();
+  stdout.push('\n');
   if let Some(uuid) = Regex::new(r"\nRequestUUID = (.+?)\n")?
-    .captures_iter(stdout)
+    .captures_iter(&stdout)
     .next()
   {
     info!("notarization started; waiting for Apple response...");
@@ -325,9 +326,10 @@ fn get_notarization_status(
     .output_ok();
 
   if let Ok(output) = result {
-    let stdout = std::str::from_utf8(&output.stdout)?;
+    let mut stdout = std::str::from_utf8(&output.stdout)?.to_string();
+    stdout.push('\n');
     if let Some(status) = Regex::new(r"\n *Status: (.+?)\n")?
-      .captures_iter(stdout)
+      .captures_iter(&stdout)
       .next()
     {
       let status = status[1].to_string();