Fix regression for #4178 and others introduced by 364c839

...while still keeping intact the fix for #5519.
This commit is contained in:
Mahmoud Al-Qudsi 2019-01-21 20:29:31 -06:00
parent 07e03dd794
commit 0edaf42d10

View File

@ -2492,8 +2492,16 @@ const wchar_t *reader_readline(int nchars) {
if (tcgetattr(STDIN_FILENO, &old_modes) == -1 && errno == EIO) redirect_tty_output();
// Set the new modes.
if (tcsetattr(0, TCSANOW, &shell_modes) == -1) {
if (errno == EIO) redirect_tty_output();
wperror(L"tcsetattr");
int err = errno;
if (err == EIO) {
redirect_tty_output();
}
// This check is required to work around certain issues with fish's approach to
// terminal control when launching interactive processes while in non-interactive
// mode. See #4178 for one such example.
if (err != ENOTTY || is_interactive_session) {
wperror(L"tcsetattr");
}
}
while (!finished && !data->end_loop) {