aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2014-12-10 17:22:13 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2014-12-10 17:22:13 +0100
commitd598a8d4e655b095c741f0cf73e139b3c9524da1 (patch)
tree31e8f0db6316820270b396380f7486c5eeb157e9
parent202d9a646489ed3f15c0460d76776b3dfb1d4e72 (diff)
downloadbusybox-w32-d598a8d4e655b095c741f0cf73e139b3c9524da1.tar.gz
busybox-w32-d598a8d4e655b095c741f0cf73e139b3c9524da1.tar.bz2
busybox-w32-d598a8d4e655b095c741f0cf73e139b3c9524da1.zip
lineedit: don't fall back to simple line input if tty is in raw mode
Testcase: shell command input after python ^Z should still work Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/lineedit.c8
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)