rustyline icon indicating copy to clipboard operation
rustyline copied to clipboard

Avoid EINTR in readline by repeating poll-call.

Open Marthog opened this issue 4 years ago • 4 comments

Fixes #402 by repeating the call on EINTR.

Marthog avatar Jun 17 '20 08:06 Marthog

Thanks. But I am not sure we should loop.

  • https://github.com/kkawakam/rustyline/blob/master/src/tty/unix.rs#L417 Here, we try to make the distinction between a single ESC and an escape sequence. I guess we can safely assume that a single ESC was received if an EINTR is raised.
  • https://github.com/kkawakam/rustyline/blob/master/src/tty/unix.rs#L705 Here, we try to find the current cursor position. I guess we can safely assume that cursor position is OK if an EINTR is raised.

gwenn avatar Jun 17 '20 19:06 gwenn

An EINTR can be caused by any signal, including SIGSTOP, SIGCHLD, SIGWINCH or SIGUSR1.

bjorn3 avatar Jun 18 '20 13:06 bjorn3

An EINTR can be caused by any signal, including SIGSTOP, SIGCHLD, SIGWINCH or SIGUSR1.

Indeed! At least, we should not ignore SIGWINCH.

gwenn avatar Jun 18 '20 17:06 gwenn

See #420.

gwenn avatar Jul 26 '20 14:07 gwenn