]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0114: MS-Windows: terminal output may go to wrong terminal v9.2.0114
authorgcrtnst <52910071+gcrtnst@users.noreply.github.com>
Sat, 7 Mar 2026 10:01:49 +0000 (10:01 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 7 Mar 2026 10:01:49 +0000 (10:01 +0000)
Problem:  MS-Windows: terminal output may go to wrong terminal with
          ConPTY
Solution: Explicitly disable inheriting the terminal handles
          (gcrtnst).

closes: #19589

Signed-off-by: gcrtnst <52910071+gcrtnst@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/terminal.c
src/version.c

index cea79dac6e726a36df29f021a08365094753419f..86e9755687b51b609f914d2e02c47e6200db7761 100644 (file)
@@ -7134,6 +7134,15 @@ conpty_term_and_job_init(
 
     term->tl_siex.StartupInfo.cb = sizeof(term->tl_siex);
 
+    // Explicitly invalidate std handles to prevent inheritance of
+    // the debugger's stdout (e.g., in Visual Studio debugging sessions),
+    // which could cause job output to go to the debugger instead of
+    // the intended ConPTY, even with bInheritHandles set to FALSE in CreateProcess.
+    term->tl_siex.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
+    term->tl_siex.StartupInfo.hStdInput = INVALID_HANDLE_VALUE;
+    term->tl_siex.StartupInfo.hStdOutput = INVALID_HANDLE_VALUE;
+    term->tl_siex.StartupInfo.hStdError = INVALID_HANDLE_VALUE;
+
     // Set up pipe inheritance safely: Vista or later.
     pInitializeProcThreadAttributeList(NULL, 1, 0, &breq);
     term->tl_siex.lpAttributeList = alloc(breq);
index 3cddb4bc0b03a880e5fd8e0c3e59f169fdad070d..6c37163dc85f21e0c3980208e1cbdf1c40a84b57 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    114,
 /**/
     113,
 /**/