This commit is contained in:
Jonathan Turner 2019-06-14 10:49:16 +12:00
parent f40089f29b
commit d94e0d436e
2 changed files with 5 additions and 3 deletions

View file

@ -217,8 +217,6 @@ impl std::ops::Try for LineResult {
async fn process_line(readline: Result<String, ReadlineError>, ctx: &mut Context) -> LineResult { async fn process_line(readline: Result<String, ReadlineError>, ctx: &mut Context) -> LineResult {
match &readline { match &readline {
Ok(line) if line.trim() == "exit" => LineResult::Break,
Ok(line) if line.trim() == "" => LineResult::Success(line.clone()), Ok(line) if line.trim() == "" => LineResult::Success(line.clone()),
Ok(line) => { Ok(line) => {

View file

@ -135,7 +135,11 @@ impl InternalCommand {
futures::future::ready(None) futures::future::ready(None)
} }
CommandAction::Exit => { 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) futures::future::ready(None)
} }
}, },