Skip to content

Commit 3e3e419

Browse files
committed
Fix test waitgroups
1 parent 76218f0 commit 3e3e419

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

localexec_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ func testExecer(ctx context.Context, t *testing.T, execer Execer) {
2626
assert.Success(t, "start local cmd", err)
2727

2828
var wg sync.WaitGroup
29+
wg.Add(1)
2930
go func() {
30-
wg.Add(1)
3131
defer wg.Done()
3232

3333
stdout, err := ioutil.ReadAll(process.Stdout())
@@ -37,8 +37,8 @@ func testExecer(ctx context.Context, t *testing.T, execer Execer) {
3737

3838
assert.Equal(t, "stdout", wd, strings.TrimSuffix(string(stdout), "\n"))
3939
}()
40+
wg.Add(1)
4041
go func() {
41-
wg.Add(1)
4242
defer wg.Done()
4343

4444
stderr, err := ioutil.ReadAll(process.Stderr())

tty_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ func testTTY(ctx context.Context, t *testing.T, e Execer) {
3131
})
3232
assert.Success(t, "start bash", err)
3333
var wg sync.WaitGroup
34+
wg.Add(1)
3435
go func() {
35-
wg.Add(1)
3636
defer wg.Done()
3737

3838
stdout, err := ioutil.ReadAll(process.Stdout())
3939
assert.Success(t, "read stdout", err)
4040

4141
t.Logf("bash tty stdout = %s", stdout)
4242
prompt := string(stdout)
43-
assert.True(t, `bash "$" prompt found`,
43+
assert.True(t, `bash "$" or "#" prompt found`,
4444
strings.HasSuffix(prompt, "$ ") || strings.HasSuffix(prompt, "# "))
4545
}()
46+
wg.Add(1)
4647
go func() {
47-
wg.Add(1)
4848
defer wg.Done()
4949

5050
stderr, err := ioutil.ReadAll(process.Stderr())

0 commit comments

Comments
 (0)