|
| 1 | +diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c |
| 2 | +index 7e1f15544b17..37bc2c4ace57 100644 |
| 3 | +--- a/deps/uv/src/win/tty.c |
| 4 | ++++ b/deps/uv/src/win/tty.c |
| 5 | +@@ -58,6 +58,9 @@ |
| 6 | + #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING |
| 7 | + #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 |
| 8 | + #endif |
| 9 | ++#ifndef ENABLE_VIRTUAL_TERMINAL_INPUT |
| 10 | ++#define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200 |
| 11 | ++#endif |
| 12 | + |
| 13 | + #define CURSOR_SIZE_SMALL 25 |
| 14 | + #define CURSOR_SIZE_LARGE 100 |
| 15 | +@@ -344,6 +347,7 @@ static void uv__tty_capture_initial_style( |
| 16 | + |
| 17 | + int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { |
| 18 | + DWORD flags; |
| 19 | ++ DWORD try_set_flags; |
| 20 | + unsigned char was_reading; |
| 21 | + uv_alloc_cb alloc_cb; |
| 22 | + uv_read_cb read_cb; |
| 23 | +@@ -360,9 +364,11 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { |
| 24 | + switch (mode) { |
| 25 | + case UV_TTY_MODE_NORMAL: |
| 26 | + flags = ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; |
| 27 | ++ try_set_flags = 0; |
| 28 | + break; |
| 29 | + case UV_TTY_MODE_RAW: |
| 30 | + flags = ENABLE_WINDOW_INPUT; |
| 31 | ++ try_set_flags = ENABLE_VIRTUAL_TERMINAL_INPUT; |
| 32 | + break; |
| 33 | + case UV_TTY_MODE_IO: |
| 34 | + return UV_ENOTSUP; |
| 35 | +@@ -386,7 +392,10 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { |
| 36 | + } |
| 37 | + |
| 38 | + uv_sem_wait(&uv_tty_output_lock); |
| 39 | +- if (!SetConsoleMode(tty->handle, flags)) { |
| 40 | ++ if ( |
| 41 | ++ !SetConsoleMode(tty->handle, flags | try_set_flags) && |
| 42 | ++ !SetConsoleMode(tty->handle, flags) |
| 43 | ++ ) { |
| 44 | + err = uv_translate_sys_error(GetLastError()); |
| 45 | + uv_sem_post(&uv_tty_output_lock); |
| 46 | + return err; |
0 commit comments