From 8fa0401640d0a1ca0320e6da2fd2701576b8ceff Mon Sep 17 00:00:00 2001 From: Soispha Peetz Date: Sat, 28 Nov 2026 23:57:23 +0100 Subject: pkgs/fupdate: Exec the update command That hopefully avoids commands hanging around after Ctrl+C. --- pkgs/by-name/fu/fupdate/src/main.rs | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'pkgs/by-name/fu') diff --git a/pkgs/by-name/fu/fupdate/src/main.rs b/pkgs/by-name/fu/fupdate/src/main.rs index 2200ce83..d3c68bff 100644 --- a/pkgs/by-name/fu/fupdate/src/main.rs +++ b/pkgs/by-name/fu/fupdate/src/main.rs @@ -8,9 +8,9 @@ // You should have received a copy of the License along with this program. // If not, see . -use std::process::Command; +use std::{os::unix::process::CommandExt, process::Command}; -use anyhow::{Context, Result, bail}; +use anyhow::{Context, Result}; use clap::{CommandFactory, Parser}; pub mod cli; @@ -24,26 +24,17 @@ fn main() -> Result<(), anyhow::Error> { let command = args.command.first().map_or("flake", String::as_str); - { - let args = if args.command.len() > 1 { - &args.command[1..] - } else { - &[] - }; + let args = if args.command.len() > 1 { + &args.command[1..] + } else { + &[] + }; - // println!("Running: `fupdate-{command} {}`", args.join(" ")); + // println!("Running: `fupdate-{command} {}`", args.join(" ")); - let child = Command::new(format!("fupdate-{command}")) - .args(args) - .status() - .with_context(|| format!("Failed to spawn `fupdate-{command}`"))?; + let maybe_error = Command::new(format!("fupdate-{command}")).args(args).exec(); - if !child.success() { - bail!("Command `fupdate-{command} {}` failed!", args.join(" ")); - } - } - - Ok(()) + Err(maybe_error).context("`exec`ing failed :/") } #[cfg(test)] -- cgit v1.3.1