]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - eval.c
bash-5.2 distribution sources and documentation
[thirdparty/bash.git] / eval.c
diff --git a/eval.c b/eval.c
index 1d967da1f8978bb1a6b4206c3519d147e821c497..17fbf7366b4de3beab84f17e8d037bc5f0a61ae6 100644 (file)
--- a/eval.c
+++ b/eval.c
@@ -1,6 +1,6 @@
 /* eval.c -- reading and evaluating commands. */
 
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
    This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -90,12 +90,13 @@ reader_loop ()
          switch (code)
            {
              /* Some kind of throw to top_level has occurred. */
-           case FORCE_EOF:
            case ERREXIT:
+             if (exit_immediately_on_error)
+               reset_local_contexts ();        /* not in a function */
+           case FORCE_EOF:
            case EXITPROG:
+           case EXITBLTIN:
              current_command = (COMMAND *)NULL;
-             if (exit_immediately_on_error)
-               variable_context = 0;   /* not in a function */
              EOF_Reached = EOF;
              goto exec_done;
 
@@ -139,7 +140,7 @@ reader_loop ()
        {
          if (interactive_shell == 0 && read_but_dont_execute)
            {
-             set_exit_status (EXECUTION_SUCCESS);
+             set_exit_status (last_command_exit_value);
              dispose_command (global_command);
              global_command = (COMMAND *)NULL;
            }