diff options
-rw-r--r-- | libbb/lineedit.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 85643079b..3961b1de3 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -2256,9 +2256,13 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman | |||
2256 | INIT_S(); | 2256 | INIT_S(); |
2257 | 2257 | ||
2258 | if (tcgetattr(STDIN_FILENO, &initial_settings) < 0 | 2258 | if (tcgetattr(STDIN_FILENO, &initial_settings) < 0 |
2259 | || !(initial_settings.c_lflag & ECHO) | 2259 | || (initial_settings.c_lflag & (ECHO|ICANON)) == ICANON |
2260 | ) { | 2260 | ) { |
2261 | /* Happens when e.g. stty -echo was run before */ | 2261 | /* Happens when e.g. stty -echo was run before. |
2262 | * But if ICANON is not set, we don't come here. | ||
2263 | * (example: interactive python ^Z-backgrounded, | ||
2264 | * tty is still in "raw mode"). | ||
2265 | */ | ||
2262 | parse_and_put_prompt(prompt); | 2266 | parse_and_put_prompt(prompt); |
2263 | /* fflush_all(); - done by parse_and_put_prompt */ | 2267 | /* fflush_all(); - done by parse_and_put_prompt */ |
2264 | if (fgets(command, maxsize, stdin) == NULL) | 2268 | if (fgets(command, maxsize, stdin) == NULL) |