@@ -164,6 +164,20 @@ func (self *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), p
164164 scanner := bufio .NewScanner (r )
165165 scanner .Split (bufio .ScanLines )
166166
167+ data := make (chan []byte )
168+
169+ // We're reading from the scanner in a separate goroutine because on windows
170+ // if running git through a shim, we sometimes kill the parent process without
171+ // killing its children, meaning the scanner blocks forever. This solution
172+ // leaves us with a dead goroutine, but it's better than blocking all
173+ // rendering to main views.
174+ go utils .Safe (func () {
175+ for scanner .Scan () {
176+ data <- scanner .Bytes ()
177+ }
178+ close (data )
179+ })
180+
167181 loaded := false
168182
169183 go utils .Safe (func () {
@@ -203,13 +217,15 @@ func (self *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), p
203217 break outer
204218 case linesToRead := <- self .readLines :
205219 for i := 0 ; i < linesToRead .Total ; i ++ {
220+ var ok bool
221+ var line []byte
206222 select {
207223 case <- opts .Stop :
208224 break outer
209- default :
225+ case line , ok = <- data :
226+ break
210227 }
211228
212- ok := scanner .Scan ()
213229 loadingMutex .Lock ()
214230 if ! loaded {
215231 self .beforeStart ()
@@ -226,7 +242,7 @@ func (self *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), p
226242 self .onEndOfInput ()
227243 break outer
228244 }
229- writeToView (append (scanner . Bytes () , '\n' ))
245+ writeToView (append (line , '\n' ))
230246
231247 if i + 1 == linesToRead .InitialRefreshAfter {
232248 // We have read enough lines to fill the view, so do a first refresh
0 commit comments