Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 91e601d

Browse files
authored
Merge pull request #1013 from mccurdyc/mccurdyc/Issue#969/fix-flaky-ssh-test
plumbing: ssh, Fix flaky test TestAdvertisedReferencesNotExists. Fixes #969
2 parents 959dc01 + 3fe6f65 commit 91e601d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

plumbing/transport/ssh/upload_pack_test.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"os/exec"
1111
"path/filepath"
1212
"strings"
13+
"sync"
1314

1415
"gopkg.in/src-d/go-git.v4/plumbing/transport"
1516
"gopkg.in/src-d/go-git.v4/plumbing/transport/test"
@@ -97,13 +98,20 @@ func handlerSSH(s ssh.Session) {
9798
io.Copy(stdin, s)
9899
}()
99100

101+
var wg sync.WaitGroup
102+
wg.Add(2)
103+
100104
go func() {
101-
defer stderr.Close()
105+
defer wg.Done()
102106
io.Copy(s.Stderr(), stderr)
103107
}()
104108

105-
defer stdout.Close()
106-
io.Copy(s, stdout)
109+
go func() {
110+
defer wg.Done()
111+
io.Copy(s, stdout)
112+
}()
113+
114+
wg.Wait()
107115

108116
if err := cmd.Wait(); err != nil {
109117
return

0 commit comments

Comments
 (0)