[PATCH] common: cli_hush: terminate all commands when Ctrl-C is pressed
Quentin Schulz
quentin.schulz at cherry.de
Tue Jan 13 16:40:44 CET 2026
Hi Shiji Yang,
On 12/28/25 6:25 AM, Shiji Yang wrote:
> Check Ctrl-C status before executing each command in the pipeline so
> that the Ctrl-C can skip all subsequent commands. This should be the
> default behavior of most shells.
>
> Before the change:
> ```
> => echo start; while true; do echo loop; sleep 1; done; echo int; if true; then echo if; fi; echo stop
> start
> loop
> loop <-- Input Ctrl-C
> int
> if
> stop
> =>
> ```
> After the change:
> ```
> => echo start; while true; do echo loop; sleep 1; done; echo int; if true; then echo if; fi; echo stop
> start
> loop
> loop <-- Input Ctrl-C
> ^C
> =>
> ```
>
> Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
> ---
> common/cli_hush.c | 21 +++++++++++++--------
I'm assuming we want the same behavior on all shells. So if this were to
be merged, a similar implementation needs to be done for cli_hush_modern
as well.
Any chance we can get a test for this in test/hush/? I don't know if we
can send the ctrl-c keystroke (the pytest test suite can, but test/hush
is C code...).
Cheers,
Quentin
More information about the U-Boot
mailing list