diff options
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 00147103a..6285b24bd 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -9,6 +9,8 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" +#include <wingdi.h> +#include <winuser.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> @@ -554,9 +556,19 @@ fhandler_tty_slave::open (path_conv *, int flags, mode_t) set_open_status (); if (!output_done_event) { - if (fhandler_console::open_fhs++ == 0) + if (fhandler_console::open_fhs++ == 0 + && wincap.pty_needs_alloc_console ()) { - BOOL b = AllocConsole (); + BOOL b; + HWINSTA h = CreateWindowStation (NULL, 0, GENERIC_READ | GENERIC_WRITE, &sec_none_nih); + termios_printf ("CreateWindowStation %p, %E", h); + if (h) + { + b = SetProcessWindowStation (h); + termios_printf ("SetProcessWindowStation %d, %E", b); + } + b = AllocConsole (); // will cause flashing if workstation + // stuff fails termios_printf ("%d = AllocConsole ()", b); } termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs); |