From 5f399c0839b2b619af874502685f7b1863654e5e Mon Sep 17 00:00:00 2001 From: fdai7381 Date: Thu, 19 Jan 2023 01:22:45 +0100 Subject: [PATCH] feat: add exit shell error --- src/error.rs | 1 + src/main.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/error.rs b/src/error.rs index 46bbb99..76a2717 100644 --- a/src/error.rs +++ b/src/error.rs @@ -2,6 +2,7 @@ use std::process::Command; pub enum ShellError { EmptyLine, + Exit, NotFound(Command), ExecuteFailure(String), } diff --git a/src/main.rs b/src/main.rs index c19774c..c627e9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,6 +25,9 @@ fn main() -> Result<()> { Err(ShellError::EmptyLine) => { continue; } + Err(ShellError::Exit) => { + break; + } Err(ShellError::NotFound(cmd)) => { println!("{}: command not found", cmd.get_program().to_string_lossy()) }