diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2024-09-11 10:33:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-11 10:33:54 +0200 |
commit | a49f264dff6bc853d67e2d16f635ba8d80bc62a6 (patch) | |
tree | e6c03bddb8ebd947f080cff104cd63803c520eb1 /src/unix/internal.h | |
parent | 44e61dab7effb739f543b8b4eee43f577bf2db49 (diff) | |
download | libuv-a49f264dff6bc853d67e2d16f635ba8d80bc62a6.tar.gz libuv-a49f264dff6bc853d67e2d16f635ba8d80bc62a6.zip |
unix: restore tty attributes on handle close (#4399)
Libuv stores the `struct termios` for use inside uv_tty_reset_mode().
Node.js uses said function to restore the tty to its original mode
on SIGINT or SIGTERM, when there is no opportunity to shut down the
process normally.
Track uv_tty_t handle closing, otherwise we might be trying to use a
stale termios.
The current solution is not ideal because there can be multiple handles
that refer to the same tty/pty and, for various reasons, we can't really
determine when we close the last handle. The last handle may not even be
inside the current process.
Still, all things considered, it's probably (hopefully!) an improvement
over the status quo.
Refs: https://github.com/libuv/libuv/issues/4398
Diffstat (limited to 'src/unix/internal.h')
-rw-r--r-- | src/unix/internal.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/unix/internal.h b/src/unix/internal.h index a987be60..86c0d18a 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -293,6 +293,9 @@ int uv__tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb); int uv__tcp_nodelay(int fd, int on); int uv__tcp_keepalive(int fd, int on, unsigned int delay); +/* tty */ +void uv__tty_close(uv_tty_t* handle); + /* pipe */ int uv__pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb); |