Rework exit command

Prior to this fix, the `exit` command would set a global variable in the
reader, which parse_execution would check. However in concurrent mode you
may have multiple scripts being sourced at once, and 'exit' should only
apply to the current script.

Switch to using a variable in the parser's libdata instead.
This commit is contained in:
ridiculousfish
2020-08-15 14:41:11 -07:00
parent a83dbec075
commit b0182183d4
6 changed files with 102 additions and 96 deletions

View File

@@ -490,7 +490,7 @@ int main(int argc, char **argv) {
argv + my_optind);
}
res = run_command_list(parser, &opts.batch_cmds, {});
reader_set_end_loop(false);
parser.libdata().exit_current_script = false;
} else if (my_optind == argc) {
// Implicitly interactive mode.
res = reader_read(parser, STDIN_FILENO, {});