From d94e0d436e89cc65739afe14cd36149c01aaa6d6 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Fri, 14 Jun 2019 10:49:16 +1200 Subject: [PATCH] Add exit --- src/cli.rs | 2 -- src/commands/classified.rs | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 1aedf1b15..24e654da3 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -217,8 +217,6 @@ impl std::ops::Try for LineResult { async fn process_line(readline: Result, ctx: &mut Context) -> LineResult { match &readline { - Ok(line) if line.trim() == "exit" => LineResult::Break, - Ok(line) if line.trim() == "" => LineResult::Success(line.clone()), Ok(line) => { diff --git a/src/commands/classified.rs b/src/commands/classified.rs index 75e3877ef..fcd9586f2 100644 --- a/src/commands/classified.rs +++ b/src/commands/classified.rs @@ -135,7 +135,11 @@ impl InternalCommand { futures::future::ready(None) } CommandAction::Exit => { - let _ = env.lock().unwrap().pop(); + let mut v = env.lock().unwrap(); + if v.len() == 1 { + std::process::exit(0); + } + v.pop(); futures::future::ready(None) } },