mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 12:40:42 +02:00
commit bash-20090723 snapshot
This commit is contained in:
+18
-3
@@ -3814,25 +3814,35 @@ execute_builtin (builtin, words, flags, subshell)
|
||||
{
|
||||
int old_e_flag, result, eval_unwind;
|
||||
int isbltinenv;
|
||||
char *error_trap;
|
||||
|
||||
#if 0
|
||||
/* XXX -- added 12/11 */
|
||||
terminate_immediately++;
|
||||
#endif
|
||||
|
||||
error_trap = 0;
|
||||
old_e_flag = exit_immediately_on_error;
|
||||
/* The eval builtin calls parse_and_execute, which does not know about
|
||||
the setting of flags, and always calls the execution functions with
|
||||
flags that will exit the shell on an error if -e is set. If the
|
||||
eval builtin is being called, and we're supposed to ignore the exit
|
||||
value of the command, we turn the -e flag off ourselves, then
|
||||
restore it when the command completes. This is also a problem (as
|
||||
below) for the command and source/. builtins. */
|
||||
value of the command, we turn the -e flag off ourselves and disable
|
||||
the ERR trap, then restore them when the command completes. This is
|
||||
also a problem (as below) for the command and source/. builtins. */
|
||||
if (subshell == 0 && (flags & CMD_IGNORE_RETURN) &&
|
||||
(builtin == eval_builtin || builtin == command_builtin || builtin == source_builtin))
|
||||
{
|
||||
begin_unwind_frame ("eval_builtin");
|
||||
unwind_protect_int (exit_immediately_on_error);
|
||||
error_trap = TRAP_STRING (ERROR_TRAP);
|
||||
if (error_trap)
|
||||
{
|
||||
error_trap = savestring (error_trap);
|
||||
add_unwind_protect (xfree, error_trap);
|
||||
add_unwind_protect (set_error_trap, error_trap);
|
||||
restore_default_signal (ERROR_TRAP);
|
||||
}
|
||||
exit_immediately_on_error = 0;
|
||||
eval_unwind = 1;
|
||||
}
|
||||
@@ -3883,6 +3893,11 @@ execute_builtin (builtin, words, flags, subshell)
|
||||
if (eval_unwind)
|
||||
{
|
||||
exit_immediately_on_error += old_e_flag;
|
||||
if (error_trap)
|
||||
{
|
||||
set_error_trap (error_trap);
|
||||
xfree (error_trap);
|
||||
}
|
||||
discard_unwind_frame ("eval_builtin");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user