hush: fix wrong prompt problem on empty interactive commants
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
parent
f42c7b8fc1
commit
642e71a789
11
shell/hush.c
11
shell/hush.c
@ -4140,7 +4140,16 @@ static struct pipe *parse_stream(char **pstring,
|
|||||||
if (IS_NULL_CMD(ctx.command)
|
if (IS_NULL_CMD(ctx.command)
|
||||||
&& dest.length == 0 && !dest.has_quoted_part
|
&& dest.length == 0 && !dest.has_quoted_part
|
||||||
) {
|
) {
|
||||||
continue;
|
/* This newline can be ignored. But...
|
||||||
|
* without the below check, interactive shell
|
||||||
|
* will ignore even lines with bare <newline>,
|
||||||
|
* and show the continuation prompt:
|
||||||
|
* ps1_prompt$ <enter>
|
||||||
|
* ps2> _ <=== wrong prompt, should be ps1
|
||||||
|
*/
|
||||||
|
struct pipe *pi = ctx.list_head;
|
||||||
|
if (pi->num_cmds != 0)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
/* Treat newline as a command separator. */
|
/* Treat newline as a command separator. */
|
||||||
done_pipe(&ctx, PIPE_SEQ);
|
done_pipe(&ctx, PIPE_SEQ);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user