From b078c82afda34beb2fa33f7227cc3e10ac3db226 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 18 May 2009 14:53:34 +0200 Subject: [PATCH] Error out rather than hang when plink does not know the host yet As reported in msysGit issue 96, plink wants to interact with the user asking if a host key should be accepted, but this just blocks the terminal, as plink tries to get the answer from stdin. However, stdin is already connected to Git that wants to send input to the remote command. Rather than blocking, just call plink with -batch so that it will error out with an error message. Signed-off-by: Johannes Schindelin --- connect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connect.c b/connect.c index b3c4d2205..db7020939 100644 --- a/connect.c +++ b/connect.c @@ -602,13 +602,15 @@ struct child_process *git_connect(int fd[2], const char *url_orig, die("command line too long"); conn->in = conn->out = -1; - conn->argv = arg = xcalloc(6, sizeof(*arg)); + conn->argv = arg = xcalloc(7, sizeof(*arg)); if (protocol == PROTO_SSH) { const char *ssh = getenv("GIT_SSH"); int putty = ssh && strstr(ssh, "plink"); if (!ssh) ssh = "ssh"; *arg++ = ssh; + if (putty) + *arg++ = "-batch"; if (port) { /* P is for PuTTY, p is for OpenSSH */ *arg++ = putty ? "-P" : "-p"; -- 2.11.4.GIT