Skip to content

Commit

Permalink
don't call Fatal from a goroutine
Browse files Browse the repository at this point in the history
Apparently, it's not thread-safe.
  • Loading branch information
Stebalien committed Mar 18, 2018
1 parent 49a26f3 commit 9160bdc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,10 @@ func TestCancel(t *testing.T) {
go func() {
err := re.Emit("abc")
if err != context.Canceled {
t.Fatalf("re: expected context.Canceled but got %v", err)
t.Errorf("re: expected context.Canceled but got %v", err)
} else {
t.Log("re.Emit err:", err)
}
t.Log("re.Emit err:", err)
re.Close()
close(wait)
}()
Expand All @@ -394,8 +395,9 @@ func TestCancel(t *testing.T) {

_, err = res.Next()
if err != context.Canceled {
t.Fatalf("res: expected context.Canceled but got %v", err)
t.Errorf("res: expected context.Canceled but got %v", err)
} else {
t.Log("res.Emit err:", err)
}
t.Log("res.Emit err:", err)
<-wait
}

0 comments on commit 9160bdc

Please sign in to comment.