Windows: Make OpenSSH properly detect tty detachment.
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alexander Gavrilov committed
Nov 2, 2008 at 20:11 UTC
19fb896f5b6f3e52370b43e4c9339bcbe4c0f2dd
1 file changed
+6
-2
compat/mingw.c
+6
-2
@@ -536,12 +536,16 @@ static pid_t mingw_spawnve(const char *cmd, const char **argv, char **env,
536
* would normally create a console window. But
537
* since we'll be redirecting std streams, we do
538
* not need the console.
539
+ * It is necessary to use DETACHED_PROCESS
540
+ * instead of CREATE_NO_WINDOW to make ssh
541
+ * recognize that it has no console.
542
*/
540
- flags = CREATE_NO_WINDOW;
543
+ flags = DETACHED_PROCESS;
544
} else {
545
/* There is already a console. If we specified
543
- * CREATE_NO_WINDOW here, too, Windows would
546
+ * DETACHED_PROCESS here, too, Windows would
547
* disassociate the child from the console.
548
+ * The same is true for CREATE_NO_WINDOW.
549
* Go figure!
550
*/
551
flags = 0;