summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-12-21 17:14:34 +0000
committerChristopher Faylor <me@cgf.cx>2005-12-21 17:14:34 +0000
commit247ac234f46c038e1c23094172a6151efc17c6f0 (patch)
treeac8e7b423834c0ad0eb6ad7ada60a8e100367308 /winsup/cygwin/spawn.cc
parentd4c8d84da6f556265a560515e144c4b03cb4afb1 (diff)
downloadcygnal-247ac234f46c038e1c23094172a6151efc17c6f0.tar.gz
cygnal-247ac234f46c038e1c23094172a6151efc17c6f0.tar.bz2
cygnal-247ac234f46c038e1c23094172a6151efc17c6f0.zip
* cygheap.cc (init_cygheap::manage_console_count): Revert previous change.
Handle this a different way. * external.cc (cygwin_internal): Accommodate extra hook_or_detect_cygwin argument. * hookapi.cc (cygwin_internal): Fill in subsys variable with the subsystem of the executable. * spawn.cc (av::iscui): New variable. (spawn_guts): Hide window when we don't have a console and this isn't NT/XP/2003. (av::fixup): Set iscui flag. * winsup.h (hook_or_detect_cygwin): Accommodate extra argument.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index ba16ef743..b5997ff86 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -294,8 +294,9 @@ class av
public:
int argc;
bool win16_exe;
- av (): argv (NULL) {}
- av (int ac_in, const char * const *av_in) : calloced (0), argc (ac_in), win16_exe (false)
+ bool iscui;
+ av (): argv (NULL), iscui (false) {}
+ av (int ac_in, const char * const *av_in) : calloced (0), argc (ac_in), win16_exe (false), iscui (false)
{
argv = (char **) cmalloc (HEAP_1_ARGV, (argc + 5) * sizeof (char *));
memcpy (argv, av_in, (argc + 1) * sizeof (char *));
@@ -578,6 +579,11 @@ spawn_guts (const char * prog_arg, const char *const *argv,
si.hStdOutput = handle (1, 1); /* Get output handle */
si.hStdError = handle (2, 1); /* Get output handle */
si.cb = sizeof (si);
+ if (!wincap.pty_needs_alloc_console () && newargv.iscui && !GetConsoleCP ())
+ {
+ si.dwFlags |= STARTF_USESHOWWINDOW;
+ si.wShowWindow = SW_HIDE;
+ }
int flags = GetPriorityClass (hMainProc);
sigproc_printf ("priority class %d", flags);
@@ -1060,11 +1066,13 @@ av::fixup (child_info_types chtype, const char *prog_arg, path_conv& real_path,
}
if (buf[0] == 'M' && buf[1] == 'Z')
{
+ WORD subsys;
unsigned off = (unsigned char) buf[0x18] | (((unsigned char) buf[0x19]) << 8);
win16_exe = off < sizeof (IMAGE_DOS_HEADER);
if (!win16_exe)
- real_path.set_cygexec (!!hook_or_detect_cygwin (buf, NULL));
+ real_path.set_cygexec (!!hook_or_detect_cygwin (buf, NULL, subsys));
UnmapViewOfFile (buf);
+ iscui = subsys == IMAGE_SUBSYSTEM_WINDOWS_CUI;
break;
}
}