On 11/4/25 12:16 AM, Grisha Levit wrote:
If an interactive shell receives an untrapped SIGINT while executing
a builtin, any output pending output on stdout, even if redirected,
ends up written to the terminal [1]:

     $ printf %1000000000s X Y Z >/dev/null
     ^C[ ...]X

I'm not sure about the right fix here but maybe it would make sense
for throw_to_top_level to fpurge stdout before undoing redirections,
like execute_builtin_or_function would do when a builtin terminates
normally, but without fflush-ing it first.

Thanks for the report. I think it's reasonable to call fpurge in throw_to_top_level, since doing it in one of the redirection functions (e.g., do_redirection_internal)
would require you to have the same information anyway to avoid the
fflush, and it's easier to do it there.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to