diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/shell/hush.c b/shell/hush.c index f9f815289..58d2c11a9 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -4123,15 +4123,26 @@ static struct pipe *parse_stream(char **pstring, | |||
4123 | && dest.length == 0 && !dest.has_quoted_part | 4123 | && dest.length == 0 && !dest.has_quoted_part |
4124 | ) { | 4124 | ) { |
4125 | /* This newline can be ignored. But... | 4125 | /* This newline can be ignored. But... |
4126 | * without the below check, interactive shell | 4126 | * Without check #1, interactive shell |
4127 | * will ignore even lines with bare <newline>, | 4127 | * ignores even bare <newline>, |
4128 | * and show the continuation prompt: | 4128 | * and shows the continuation prompt: |
4129 | * ps1_prompt$ <enter> | 4129 | * ps1_prompt$ <enter> |
4130 | * ps2> _ <=== wrong prompt, should be ps1 | 4130 | * ps2> _ <=== wrong, should be ps1 |
4131 | * Without check #2, "cmd & <newline>" | ||
4132 | * is similarly mistreated. | ||
4133 | * (BTW, this makes "cmd & cmd" | ||
4134 | * and "cmd && cmd" non-orthogonal. | ||
4135 | * Really, ask yourself, why | ||
4136 | * "cmd && <newline>" doesn't start | ||
4137 | * cmd but waits for more input? | ||
4138 | * No reason...) | ||
4131 | */ | 4139 | */ |
4132 | struct pipe *pi = ctx.list_head; | 4140 | struct pipe *pi = ctx.list_head; |
4133 | if (pi->num_cmds != 0) | 4141 | if (pi->num_cmds != 0 /* check #1 */ |
4142 | && pi->followup != PIPE_BG /* check #2 */ | ||
4143 | ) { | ||
4134 | continue; | 4144 | continue; |
4145 | } | ||
4135 | } | 4146 | } |
4136 | /* Treat newline as a command separator. */ | 4147 | /* Treat newline as a command separator. */ |
4137 | done_pipe(&ctx, PIPE_SEQ); | 4148 | done_pipe(&ctx, PIPE_SEQ); |