patch 9.2.0114: MS-Windows: terminal output may go to wrong terminal
Commit:
https://github.com/vim/vim/commit/78ae2ff09438c4383d570f4c92e23134805cf0b7
Author: gcrtnst <[email protected]>
Date: Sat Mar 7 10:01:49 2026 +0000
patch 9.2.0114: MS-Windows: terminal output may go to wrong terminal
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 <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/terminal.c b/src/terminal.c
index cea79dac6..86e975568 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -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);
diff --git a/src/version.c b/src/version.c
index 3cddb4bc0..6c37163dc 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 114,
/**/
113,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1vyogZ-00B3oC-MG%40256bit.org.