diff --git a/src/builtins/exit.rs b/src/builtins/exit.rs index 323f911..6b4d2ee 100644 --- a/src/builtins/exit.rs +++ b/src/builtins/exit.rs @@ -5,11 +5,11 @@ pub struct Exit; impl Builtin for Exit { fn execute(&mut self, _: Vec) -> Result<(), ShellError> { - Err(ShellError::Exit) + std::process::exit(0) } } -#[cfg(test)] +/*#[cfg(test)] mod tests { use super::*; @@ -22,4 +22,4 @@ mod tests { fn test_exit_without_args() { assert_eq!(Exit.execute(vec![]), Err(ShellError::Exit)) } -} +}*/ diff --git a/src/error.rs b/src/error.rs index 6b24ea0..dba8036 100644 --- a/src/error.rs +++ b/src/error.rs @@ -3,7 +3,6 @@ use std::process::Command; #[derive(Debug)] pub enum ShellError { EmptyLine, - Exit, NotFound(Command), ExecuteFailure(String), MalformedArgs(String), @@ -13,7 +12,6 @@ impl PartialEq for ShellError { fn eq(&self, other: &Self) -> bool { match self { &ShellError::EmptyLine => matches!(other, ShellError::EmptyLine), - &ShellError::Exit => matches!(other, ShellError::Exit), &ShellError::NotFound(_) => matches!(other, ShellError::NotFound(_)), &ShellError::ExecuteFailure(_) => matches!(other, ShellError::ExecuteFailure(_)), &ShellError::MalformedArgs(_) => matches!(other, ShellError::MalformedArgs(_)), diff --git a/src/main.rs b/src/main.rs index 7d66488..0b84cd6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,9 +25,6 @@ fn main() -> Result<()> { Err(ShellError::EmptyLine) => { continue; } - Err(ShellError::Exit) => { - break; - } Err(ShellError::NotFound(cmd)) => { eprintln!("{}: command not found", cmd.get_program().to_string_lossy()) }