bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fpurge upon SIGINT


From: Chet Ramey
Subject: Re: fpurge upon SIGINT
Date: Wed, 5 Nov 2025 16:24:17 -0500
User-agent: Mozilla Thunderbird

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    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]