diff options
author | Ron Yorston <rmy@pobox.com> | 2018-05-25 11:25:42 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-05-25 11:25:42 +0100 |
commit | 9242776725024948674b9b77650fa597a1cbc99f (patch) | |
tree | cebe4d63584fb71422165f25ad30c29ddf71de69 /libbb/lineedit.c | |
parent | 28ade29e98c3bf14fd2818684d2de0789efee312 (diff) | |
download | busybox-w32-9242776725024948674b9b77650fa597a1cbc99f.tar.gz busybox-w32-9242776725024948674b9b77650fa597a1cbc99f.tar.bz2 busybox-w32-9242776725024948674b9b77650fa597a1cbc99f.zip |
win32: reinstate code in read_line_input to handle non-ttys
Commit f7c592f6d "win32: exclude termios code" excluded some code
to handle line input when stdin or stdout aren't ttys. It turns
out that this is required when 'busybox sh -i' is run from an MSYS2
shell. See GitHub issue #115.
Revert this part of the commit.
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r-- | libbb/lineedit.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 431f1c048..6ecf01765 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -2402,6 +2402,11 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman | |||
2402 | | TERMIOS_CLEAR_ISIG /* turn off INTR (ctrl-C), QUIT, SUSP */ | 2402 | | TERMIOS_CLEAR_ISIG /* turn off INTR (ctrl-C), QUIT, SUSP */ |
2403 | ); | 2403 | ); |
2404 | if (n != 0 || (initial_settings.c_lflag & (ECHO|ICANON)) == ICANON) { | 2404 | if (n != 0 || (initial_settings.c_lflag & (ECHO|ICANON)) == ICANON) { |
2405 | #else | ||
2406 | initial_settings.c_cc[VINTR] = CTRL('C'); | ||
2407 | initial_settings.c_cc[VEOF] = CTRL('D'); | ||
2408 | if (!isatty(0) || !isatty(1)) { | ||
2409 | #endif | ||
2405 | /* Happens when e.g. stty -echo was run before. | 2410 | /* Happens when e.g. stty -echo was run before. |
2406 | * But if ICANON is not set, we don't come here. | 2411 | * But if ICANON is not set, we don't come here. |
2407 | * (example: interactive python ^Z-backgrounded, | 2412 | * (example: interactive python ^Z-backgrounded, |
@@ -2416,10 +2421,6 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman | |||
2416 | DEINIT_S(); | 2421 | DEINIT_S(); |
2417 | return len; | 2422 | return len; |
2418 | } | 2423 | } |
2419 | #else | ||
2420 | initial_settings.c_cc[VINTR] = CTRL('C'); | ||
2421 | initial_settings.c_cc[VEOF] = CTRL('D'); | ||
2422 | #endif | ||
2423 | 2424 | ||
2424 | init_unicode(); | 2425 | init_unicode(); |
2425 | 2426 | ||