[git commit] lineedit: don't fall back to simple line input if tty is in raw mode
Denys Vlasenko
vda.linux at googlemail.com
Wed Dec 10 16:22:13 UTC 2014
commit: http://git.busybox.net/busybox/commit/?id=d598a8d4e655b095c741f0cf73e139b3c9524da1
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
Testcase: shell command input after python ^Z should still work
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
libbb/lineedit.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 8564307..3961b1d 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
INIT_S();
if (tcgetattr(STDIN_FILENO, &initial_settings) < 0
- || !(initial_settings.c_lflag & ECHO)
+ || (initial_settings.c_lflag & (ECHO|ICANON)) == ICANON
) {
- /* Happens when e.g. stty -echo was run before */
+ /* Happens when e.g. stty -echo was run before.
+ * But if ICANON is not set, we don't come here.
+ * (example: interactive python ^Z-backgrounded,
+ * tty is still in "raw mode").
+ */
parse_and_put_prompt(prompt);
/* fflush_all(); - done by parse_and_put_prompt */
if (fgets(command, maxsize, stdin) == NULL)
More information about the busybox-cvs
mailing list