Skip to content

Commit

Permalink
plumbing: ssh, Fix flaky test TestAdvertisedReferencesNotExists. Fixes
Browse files Browse the repository at this point in the history
…src-d#969

Signed-off-by: Colton McCurdy <[email protected]>
  • Loading branch information
mccurdyc committed Nov 1, 2018
1 parent 50bbba3 commit 43d4551
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plumbing/transport/ssh/upload_pack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 43d4551

Please sign in to comment.