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.

[1] when throw_to_top_level calls fflush after run_unwind_protects
    https://git.gnu.org/cgit/bash.git/tree/sig.c?id=c299f535#n475

Reply via email to