aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColton McCurdy <mccurdyc22@gmail.com>2018-11-01 08:01:24 -0400
committerColton McCurdy <mccurdyc22@gmail.com>2018-11-01 08:01:24 -0400
commit43d4551b4b6e49af1a1402047b3a81fbcd6a85e9 (patch)
treebd01a18165fe66e44af23daa77b00c84e4206c4c
parent50bbba3872116aa3e5a37c316b1fda83a7fac344 (diff)
downloadgo-git-43d4551b4b6e49af1a1402047b3a81fbcd6a85e9.tar.gz
plumbing: ssh, Fix flaky test TestAdvertisedReferencesNotExists. Fixes #969
Signed-off-by: Colton McCurdy <mccurdyc22@gmail.com>
-rw-r--r--plumbing/transport/ssh/upload_pack_test.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/plumbing/transport/ssh/upload_pack_test.go b/plumbing/transport/ssh/upload_pack_test.go
index 87fd4f5..2685ff0 100644
--- a/plumbing/transport/ssh/upload_pack_test.go
+++ b/plumbing/transport/ssh/upload_pack_test.go
@@ -10,6 +10,7 @@ import (
"os/exec"
"path/filepath"
"strings"
+ "sync"
"gopkg.in/src-d/go-git.v4/plumbing/transport"
"gopkg.in/src-d/go-git.v4/plumbing/transport/test"
@@ -97,13 +98,20 @@ func handlerSSH(s ssh.Session) {
io.Copy(stdin, s)
}()
+ var wg sync.WaitGroup
+ wg.Add(2)
+
go func() {
- defer stderr.Close()
+ defer wg.Done()
io.Copy(s.Stderr(), stderr)
}()
- defer stdout.Close()
- io.Copy(s, stdout)
+ go func() {
+ defer wg.Done()
+ io.Copy(s, stdout)
+ }()
+
+ wg.Wait()
if err := cmd.Wait(); err != nil {
return