tui: fix problem with uv_tty_set_mode failing due to signal

fixes #12322.
This commit is contained in:
erw7 2020-10-12 10:09:36 +09:00
parent 3a597cb1a0
commit 2e70fee1e9

View File

@ -316,7 +316,13 @@ static void terminfo_start(UI *ui)
#ifdef WIN32 #ifdef WIN32
uv_tty_set_mode(&data->output_handle.tty, UV_TTY_MODE_RAW); uv_tty_set_mode(&data->output_handle.tty, UV_TTY_MODE_RAW);
#else #else
uv_tty_set_mode(&data->output_handle.tty, UV_TTY_MODE_IO); int retry_count = 10;
// A signal may cause uv_tty_set_mode() to fail (e.g., SIGCONT). Retry a
// few times. #12322
while (uv_tty_set_mode(&data->output_handle.tty, UV_TTY_MODE_IO) == UV_EINTR
&& retry_count > 0) {
retry_count--;
}
#endif #endif
} else { } else {
uv_pipe_init(&data->write_loop, &data->output_handle.pipe, 0); uv_pipe_init(&data->write_loop, &data->output_handle.pipe, 0);