diff options
Diffstat (limited to '')
-rw-r--r-- | pkgs/by-name/fu/fupdate/src/main.rs | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/pkgs/by-name/fu/fupdate/src/main.rs b/pkgs/by-name/fu/fupdate/src/main.rs index 759f65ec..b4af6cd6 100644 --- a/pkgs/by-name/fu/fupdate/src/main.rs +++ b/pkgs/by-name/fu/fupdate/src/main.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::process::Command; use anyhow::{bail, Context, Result}; @@ -23,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(" ")); } } @@ -40,7 +46,12 @@ fn main() -> Result<(), anyhow::Error> { Ok(()) } -#[test] -fn verify_cli() { - CliArgs::command().debug_assert(); +#[cfg(test)] +mod test { + use clap::CommandFactory; + + #[test] + fn verify_cli() { + super::CliArgs::command().debug_assert(); + } } |