win,tty: fix uv_tty_close()
Under some condition, uv_tty_close() would not stop console reads. This fixes that issue by first stopping read, then closing the handle. Fixes: https://github.com/nodejs/node/issues/22999 PR-URL: https://github.com/libuv/libuv/pull/2005 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
parent
60abdbaed6
commit
ee87f34474
@ -2180,14 +2180,14 @@ void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle,
|
||||
|
||||
void uv_tty_close(uv_tty_t* handle) {
|
||||
assert(handle->u.fd == -1 || handle->u.fd > 2);
|
||||
if (handle->flags & UV_HANDLE_READING)
|
||||
uv_tty_read_stop(handle);
|
||||
|
||||
if (handle->u.fd == -1)
|
||||
CloseHandle(handle->handle);
|
||||
else
|
||||
close(handle->u.fd);
|
||||
|
||||
if (handle->flags & UV_HANDLE_READING)
|
||||
uv_tty_read_stop(handle);
|
||||
|
||||
handle->u.fd = -1;
|
||||
handle->handle = INVALID_HANDLE_VALUE;
|
||||
handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user