summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkgs/by-name/fu/fupdate/src/main.rs29
1 files changed, 10 insertions, 19 deletions
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 <https://www.gnu.org/licenses/gpl-3.0.txt>.
-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)]