From 6b3bdf38e09d43240b3c4361f013bd43a49fcfb9 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 20 Apr 2003 01:36:15 +0000 Subject: * wincap.h (wincaps:pty_needs_alloc_console): New element. (wincapc:pty_needs_alloc_console): New function. * wincap.cc: Add pty_needs_alloc_console throughout. * fhandler_tty.cc (fhandler_tty_slave::open): Open an "invisible" console on first pty allocation. --- winsup/cygwin/fhandler_tty.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/fhandler_tty.cc') 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 +#include #include #include #include @@ -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); -- cgit v1.2.3