git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH (MINGW) Resend] Windows: Make OpenSSH properly detect tty detachment.

From
Alexander Gavrilov <angavrilov@gmail.com>
Date
Nov 2, 2008, 17:11 UTC
Message-ID
<200811022011.13970.angavrilov@gmail.com>

Apparently, CREATE_NO_WINDOW makes the OS tell the process that it has a console, but without actually creating the window. As a result, when git is started from GUI, ssh tries to ask its questions on the invisible console.

This patch uses DETACHED_PROCESS instead, which clearly means that the process should be left without a console. The downside is that if the process manually calls AllocConsole, the window will appear. A similar thing might occur if it calls another console executable.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
---
	This patch appears to have been overlooked, so I	resend
	it just in case. It fixes a long standing problem in msysgit.
	-- Alexander
 compat/mingw.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 1e29b88..b6fcf69 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -586,12 +586,16 @@ static pid_t mingw_spawnve(const char *cmd, const char **argv, char **env,
 		 * would normally create a console window. But
 		 * since we'll be redirecting std streams, we do
 		 * not need the console.
+		 * It is necessary to use DETACHED_PROCESS
+		 * instead of CREATE_NO_WINDOW to make ssh
+		 * recognize that it has no console.
 		 */
-		flags = CREATE_NO_WINDOW;
+		flags = DETACHED_PROCESS;
 	} else {
 		/* There is already a console. If we specified
-		 * CREATE_NO_WINDOW here, too, Windows would
+		 * DETACHED_PROCESS here, too, Windows would
 		 * disassociate the child from the console.
+		 * The same is true for CREATE_NO_WINDOW.
 		 * Go figure!
 		 */
 		flags = 0;
-- 
1.6.0.2.1256.ga12f0
Next: Johannes Sixt
Message 1 of 4 in “Windows: Make OpenSSH properly detect tty detachment.”
  1. Windows: Make OpenSSH properly detect tty detachment.Alexander Gavrilov, Nov 2, 2008
  2. Johannes SixtNov 6, 2008
  3. Junio C HamanoNov 6, 2008
  4. Johannes SixtNov 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.