aboutsummaryrefslogtreecommitdiffstats
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/cli.rs2
-rw-r--r--pkgs/by-name/fu/fupdate/src/main.rs23
2 files changed, 13 insertions, 12 deletions
diff --git a/pkgs/by-name/fu/fupdate/src/cli.rs b/pkgs/by-name/fu/fupdate/src/cli.rs
index 6ebd1bc4..a7168413 100644
--- a/pkgs/by-name/fu/fupdate/src/cli.rs
+++ b/pkgs/by-name/fu/fupdate/src/cli.rs
@@ -11,7 +11,7 @@
use std::{env, ffi::OsStr, fs::read_dir};
use clap::Parser;
-use clap_complete::{engine::ArgValueCompleter, CompletionCandidate};
+use clap_complete::{CompletionCandidate, engine::ArgValueCompleter};
/// This is a Nix flake update manager.
#[derive(Parser, Debug)]
diff --git a/pkgs/by-name/fu/fupdate/src/main.rs b/pkgs/by-name/fu/fupdate/src/main.rs
index e664628a..2200ce83 100644
--- a/pkgs/by-name/fu/fupdate/src/main.rs
+++ b/pkgs/by-name/fu/fupdate/src/main.rs
@@ -10,7 +10,7 @@
use std::process::Command;
-use anyhow::{bail, Context, Result};
+use anyhow::{Context, Result, bail};
use clap::{CommandFactory, Parser};
pub mod cli;
@@ -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(" "));
}
}
@@ -50,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();
+ }
}