summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_tty.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-04-20 01:36:15 +0000
committerChristopher Faylor <me@cgf.cx>2003-04-20 01:36:15 +0000
commit6b3bdf38e09d43240b3c4361f013bd43a49fcfb9 (patch)
tree707277f43bcfd7dece9584c52c155ae721d44abb /winsup/cygwin/fhandler_tty.cc
parentafa18d8a69f469b0bf2cd1da79d1ae93382129e5 (diff)
downloadcygnal-6b3bdf38e09d43240b3c4361f013bd43a49fcfb9.tar.gz
cygnal-6b3bdf38e09d43240b3c4361f013bd43a49fcfb9.tar.bz2
cygnal-6b3bdf38e09d43240b3c4361f013bd43a49fcfb9.zip
* 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.
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r--winsup/cygwin/fhandler_tty.cc16
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);