From 1ecc0ff050d74aef548677fb97b2113b0920c711 Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Mon, 25 Apr 2016 14:04:10 +0530 Subject: [PATCH] Do not set terminate_immediately while reading input --- builtins/read.def | 3 +-- parse.y | 5 +---- y.tab.c | 5 +---- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/builtins/read.def b/builtins/read.def index 1ef9142..2dcaf35 100644 --- a/builtins/read.def +++ b/builtins/read.def @@ -455,7 +455,6 @@ read_builtin (list) of the unwind-protect stack after the realloc() works right. */ add_unwind_protect (xfree, input_string); interrupt_immediately++; - terminate_immediately++; unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe; @@ -512,6 +511,7 @@ read_builtin (list) if (retval <= 0) { + CHECK_TERMSIG; eof = 1; break; } @@ -616,7 +616,6 @@ add_char: zsyncfd (fd); interrupt_immediately--; - terminate_immediately--; discard_unwind_frame ("read_builtin"); retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS; diff --git a/parse.y b/parse.y index 9a78d0c..0b9f9ff 100644 --- a/parse.y +++ b/parse.y @@ -1440,12 +1440,11 @@ yy_readline_get () old_sigint = (SigHandler *)set_signal_handler (SIGINT, sigint_sighandler); interrupt_immediately++; } - terminate_immediately = 1; current_readline_line = readline (current_readline_prompt ? current_readline_prompt : ""); - terminate_immediately = 0; + CHECK_TERMSIG; if (signal_is_ignored (SIGINT) == 0 && old_sigint) { interrupt_immediately--; @@ -1606,13 +1605,11 @@ yy_stream_get () if (interactive) { interrupt_immediately++; - terminate_immediately++; } result = getc_with_restart (bash_input.location.file); if (interactive) { interrupt_immediately--; - terminate_immediately--; } } return (result); diff --git a/y.tab.c b/y.tab.c index d702554..563d312 100644 --- a/y.tab.c +++ b/y.tab.c @@ -3757,12 +3757,11 @@ yy_readline_get () old_sigint = (SigHandler *)set_signal_handler (SIGINT, sigint_sighandler); interrupt_immediately++; } - terminate_immediately = 1; current_readline_line = readline (current_readline_prompt ? current_readline_prompt : ""); - terminate_immediately = 0; + CHECK_TERMSIG; if (signal_is_ignored (SIGINT) == 0 && old_sigint) { interrupt_immediately--; @@ -3923,13 +3922,11 @@ yy_stream_get () if (interactive) { interrupt_immediately++; - terminate_immediately++; } result = getc_with_restart (bash_input.location.file); if (interactive) { interrupt_immediately--; - terminate_immediately--; } } return (result); -- 2.5.5