diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-11-05 11:05:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-05 11:05:38 +0100 |
commit | 91e601df9b000c7127e0238785e8a9018fcad54a (patch) | |
tree | 5b1f0168b856665a1fb2a9eabab3af4bb056e28f | |
parent | 959dc01faa3352c0b41ff0fa257239f5f00165db (diff) | |
parent | 3fe6f65a9955d25d51d195d5d4ce43339c813534 (diff) | |
download | go-git-91e601df9b000c7127e0238785e8a9018fcad54a.tar.gz |
Merge pull request #1013 from mccurdyc/mccurdyc/Issue#969/fix-flaky-ssh-test
plumbing: ssh, Fix flaky test TestAdvertisedReferencesNotExists. Fixes #969
-rw-r--r-- | plumbing/transport/ssh/upload_pack_test.go | 14 |
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 |