mirror of
https://github.com/nushell/nushell
synced 2024-12-26 13:03:07 +00:00
Add exit
This commit is contained in:
parent
f40089f29b
commit
d94e0d436e
2 changed files with 5 additions and 3 deletions
|
@ -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) => {
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue