forked from extern/nushell
Add exit
This commit is contained in:
parent
f40089f29b
commit
d94e0d436e
@ -217,8 +217,6 @@ impl std::ops::Try for LineResult {
|
||||
|
||||
async fn process_line(readline: Result<String, ReadlineError>, 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) => {
|
||||
|
@ -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)
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user