diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index a3071884e..4524423b3 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -194,24 +194,6 @@ handle (int fd, bool writing) return h; } -static bool -is_console_app (WCHAR *filename) -{ - HANDLE h; - const int id_offset = 92; - h = CreateFileW (filename, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, 0, NULL); - char buf[1024]; - DWORD n; - ReadFile (h, buf, sizeof (buf), &n, 0); - CloseHandle (h); - char *p = (char *) memmem (buf, n, "PE\0\0", 4); - if (p && p + id_offset <= buf + n) - return p[id_offset] == '\003'; /* 02: GUI, 03: console */ - else - return false; -} - int iscmd (const char *argv0, const char *what) { @@ -632,7 +614,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, STARTUPINFOEXW si_pcon; ZeroMemory (&si_pcon, sizeof (si_pcon)); STARTUPINFOW *si_tmp = &si; - if (!iscygwin () && ptys_primary && is_console_app (runpath)) + if (!iscygwin () && ptys_primary) if (ptys_primary->setup_pseudoconsole (&si_pcon)) { c_flags |= EXTENDED_STARTUPINFO_PRESENT;