From 4eddaade35baa53639f2b22ac47f3c5b5947f719 Mon Sep 17 00:00:00 2001 From: jasmine Date: Sat, 7 Jun 2025 17:54:25 +0800 Subject: [PATCH] handle command not found --- src/core.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core.rs b/src/core.rs index 7e3c3a6..1533c39 100644 --- a/src/core.rs +++ b/src/core.rs @@ -31,8 +31,9 @@ pub fn get_args(tokens: Vec<&str>) -> Vec<&str> { pub fn execute(cmd: &str, args: Vec<&str>) { let status = Command::new(cmd) .args(args) - .status() - .expect("failed to execute process"); + .status(); - assert!(status.success()); + if status.is_err() { + println!("{}: command not found", cmd) + } }