File tree 1 file changed +17
-0
lines changed 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,23 @@ func runGet(cmd *Command, args []string) {
98
98
os .Setenv ("GIT_TERMINAL_PROMPT" , "0" )
99
99
}
100
100
101
+ // Disable any ssh connection pooling by Git.
102
+ // If a Git subprocess forks a child into the background to cache a new connection,
103
+ // that child keeps stdout/stderr open. After the Git subprocess exits,
104
+ // os /exec expects to be able to read from the stdout/stderr pipe
105
+ // until EOF to get all the data that the Git subprocess wrote before exiting.
106
+ // The EOF doesn't come until the child exits too, because the child
107
+ // is holding the write end of the pipe.
108
+ // This is unfortunate, but it has come up at least twice
109
+ // (see golang.org/issue/13453 and golang.org/issue/16104)
110
+ // and confuses users when it does.
111
+ // If the user has explicitly set GIT_SSH or GIT_SSH_COMMAND,
112
+ // assume they know what they are doing and don't step on it.
113
+ // But default to turning off ControlMaster.
114
+ if os .Getenv ("GIT_SSH" ) == "" && os .Getenv ("GIT_SSH_COMMAND" ) == "" {
115
+ os .Setenv ("GIT_SSH_COMMAND" , "ssh -o ControlMaster=no" )
116
+ }
117
+
101
118
// Phase 1. Download/update.
102
119
var stk importStack
103
120
mode := 0
You can’t perform that action at this time.
0 commit comments