Add exit code argument (#3132)

This commit is contained in:
Tiffany Bennett
2021-03-05 21:46:27 -08:00
committed by GitHub
parent 983de8974b
commit d43489a6a0
5 changed files with 55 additions and 12 deletions

View File

@ -62,7 +62,7 @@ pub(crate) async fn run_internal_command(
context.shell_manager.set_path(path);
InputStream::empty()
}
CommandAction::Exit => std::process::exit(0), // TODO: save history.txt
CommandAction::Exit(code) => std::process::exit(code), // TODO: save history.txt
CommandAction::Error(err) => {
context.error(err);
InputStream::empty()
@ -213,10 +213,10 @@ pub(crate) async fn run_internal_command(
context.shell_manager.next();
InputStream::empty()
}
CommandAction::LeaveShell => {
CommandAction::LeaveShell(code) => {
context.shell_manager.remove_at_current();
if context.shell_manager.is_empty() {
std::process::exit(0); // TODO: save history.txt
std::process::exit(code); // TODO: save history.txt
}
InputStream::empty()
}