Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2022-05-14 14:39:42 +0300
committerTakashi Yano <takashi.yano@nifty.ne.jp>2022-05-15 01:25:56 +0300
commitfaf1e11592569845d348650bc702f424edb1f2d8 (patch)
treeef92d8ce95ee5b4083f952ead9ded9401cebdbbf /winsup/utils
parent8f66bc28ae461763d1da91384a652512590eea16 (diff)
Cygwin: pty: Fix script command crash on console in Win7.
- Previously, the command "cmd /c script -c cmd" in console of Win7 crashes. This seems to be due to a bug (?) of AttachConsole(). This patch adds workaround for this issue. Currently, pty reattaches to the console of the process which is predetermined by ConsoleProcessList() after temporarily attaching to another console. After that, the console output handle opened with the name "CONOUT$" may not be accessible in Win7. This seems to happen when the attached process does not have the same handle even if the console attached is the same. With this patch, cygwin-console-helper which is started when pty master is opened in console, is utilized to be a target process to which pty reattaches if the OS is Win7.
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/mingw/cygwin-console-helper.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/utils/mingw/cygwin-console-helper.cc b/winsup/utils/mingw/cygwin-console-helper.cc
index 66004bd15..80d15e3f3 100644
--- a/winsup/utils/mingw/cygwin-console-helper.cc
+++ b/winsup/utils/mingw/cygwin-console-helper.cc
@@ -6,11 +6,11 @@ main (int argc, char **argv)
char *end;
if (argc < 3)
exit (1);
+ SetConsoleCtrlHandler (NULL, TRUE);
HANDLE h = (HANDLE) strtoull (argv[1], &end, 0);
SetEvent (h);
if (argc == 4) /* Pseudo console helper mode for PTY */
{
- SetConsoleCtrlHandler (NULL, TRUE);
HANDLE hPipe = (HANDLE) strtoull (argv[3], &end, 0);
char buf[64];
sprintf (buf, "StdHandles=%p,%p\n",