about summary refs log tree commit diff stats
path: root/pkgs/by-name/fu/fupdate/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkgs/by-name/fu/fupdate/src/main.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/pkgs/by-name/fu/fupdate/src/main.rs b/pkgs/by-name/fu/fupdate/src/main.rs
index 850eaf87..759f65ec 100644
--- a/pkgs/by-name/fu/fupdate/src/main.rs
+++ b/pkgs/by-name/fu/fupdate/src/main.rs
@@ -12,7 +12,7 @@ fn main() -> Result<(), anyhow::Error> {
 
     let args = CliArgs::parse();
 
-    let other = args.command.first().map_or("flake", String::as_str);
+    let command = args.command.first().map_or("flake", String::as_str);
 
     {
         let args = if args.command.len() > 1 {
@@ -21,13 +21,19 @@ fn main() -> Result<(), anyhow::Error> {
             &[]
         };
 
-        let status = Command::new(format!("fupdate-{other}"))
-            .args(args)
-            .status()
-            .with_context(|| format!("Failed to execute `fupdate-{other}`"))?;
+        // println!("Running: `fupdate-{command} {}`", args.join(" "));
 
-        if !status.success() {
-            bail!("Command `fupdate-{other}` failed!");
+        let mut child = Command::new(format!("fupdate-{command}"))
+            .args(args)
+            .spawn()
+            .with_context(|| format!("Failed to spawn `fupdate-{command}`"))?;
+
+        if !child
+            .wait()
+            .with_context(|| format!("Failed to wait for `fupdate-{command}` to finish"))?
+            .success()
+        {
+            bail!("Command `fupdate-{command} {}` failed!", args.join(" "));
         }
     }