summaryrefslogtreecommitdiff
path: root/builtins
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2018-06-01 10:22:36 -0400
committerChet Ramey <chet.ramey@case.edu>2018-06-01 10:22:36 -0400
commit64447609994bfddeef1061948022c074093e9a9f (patch)
treea54518a8f287997ccf86064d0f07ecf36f86039a /builtins
parent34dbca51a5fb5938db2e69ebb3318bbb182c2902 (diff)
downloadbash-64447609994bfddeef1061948022c074093e9a9f.tar.gz
fix for SIGINT in sourced script
Diffstat (limited to 'builtins')
-rw-r--r--builtins/trap.def4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtins/trap.def b/builtins/trap.def
index 57d9b522..d43b0ef6 100644
--- a/builtins/trap.def
+++ b/builtins/trap.def
@@ -98,6 +98,7 @@ static int display_traps __P((WORD_LIST *));
#define IGNORE 2 /* Ignore this signal. */
extern int posixly_correct, subshell_environment;
+extern int sourcelevel, running_trap;
int
trap_builtin (list)
@@ -212,6 +213,9 @@ trap_builtin (list)
was SIG_IGN? */
if (interactive)
set_signal_handler (SIGINT, sigint_sighandler);
+ /* special cases for interactive == 0 */
+ else if (interactive_shell && (sourcelevel||running_trap))
+ set_signal_handler (SIGINT, sigint_sighandler);
else
set_signal_handler (SIGINT, termsig_sighandler);
break;