0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-17 08:38:42 +00:00

birdc: Do not execute cmd on noninteractive help request

The help command triggered by '?' keeps the message in readline buffer,
so it could be edited. For noninteractive shell it leads to an unexpected
side effect that `echo <cmd> ? | birdc` executes the command <cmd> after
showing its help. Avoid this by clearing the readline buffer in such case.
This commit is contained in:
Inrin 2024-02-06 19:03:14 +01:00 committed by Ondrej Zajicek
parent ff2ebdc7e1
commit 0b52f7c01f

View File

@ -136,6 +136,9 @@ input_help(int arg, int key UNUSED)
input_start_list();
cmd_help(rl_line_buffer, rl_point);
rl_undo_command(1, 0);
/* <cmd> ? is "internal". Do not submit command in non interactive session */
if (!interactive)
rl_replace_line("", 0);
input_stop_list();
return 0;
}