diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-05-30 20:47:26 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-05-30 20:47:26 +0200 |
commit | 9828661c5ffe1e0a9a3be95bf71656adbbbda470 (patch) | |
tree | 3b23bdaf40121dd161938a6d6e91dc0aba5756dc /pkgs/by-name/fu/fupdate | |
parent | modules/river: Move the log file to `~/.cache` (diff) | |
download | nixos-config-prime.zip |
pkgs/fupdate: Make killing the update processes possible prime
`Command::spawn` will continue to run the command even if the parent exits (e.g., due to CTRL+C). This is not ideal, so we replace it with `Command::status`.
Diffstat (limited to 'pkgs/by-name/fu/fupdate')
-rw-r--r-- | pkgs/by-name/fu/fupdate/src/main.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/pkgs/by-name/fu/fupdate/src/main.rs b/pkgs/by-name/fu/fupdate/src/main.rs index e664628a..c73f2777 100644 --- a/pkgs/by-name/fu/fupdate/src/main.rs +++ b/pkgs/by-name/fu/fupdate/src/main.rs @@ -33,16 +33,12 @@ fn main() -> Result<(), anyhow::Error> { // println!("Running: `fupdate-{command} {}`", args.join(" ")); - let mut child = Command::new(format!("fupdate-{command}")) + let child = Command::new(format!("fupdate-{command}")) .args(args) - .spawn() + .status() .with_context(|| format!("Failed to spawn `fupdate-{command}`"))?; - if !child - .wait() - .with_context(|| format!("Failed to wait for `fupdate-{command}` to finish"))? - .success() - { + if !child.success() { bail!("Command `fupdate-{command} {}` failed!", args.join(" ")); } } |