Skip to content

Commit

Permalink
fix: data race on exit code (#88)
Browse files Browse the repository at this point in the history
Signed-off-by: Tronje Krop <[email protected]>
  • Loading branch information
Tronje Krop committed Sep 23, 2024
1 parent e440d42 commit 42cd032
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.17
0.0.19
2 changes: 1 addition & 1 deletion test/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type MainParams struct {
// setting the given additional environment variables (`Env`) to allow
// modification of the test environment.
func TestMain(main func()) func(t Test, param MainParams) {
errExit := &exec.ExitError{}
return func(t Test, param MainParams) {
// Switch to execute main function in test process.
if name := os.Getenv("TEST"); name != "" {
Expand All @@ -57,6 +56,7 @@ func TestMain(main func()) func(t Test, param MainParams) {
cmd := exec.Command(os.Args[0], "-test.run="+t.(*Tester).t.Name())
cmd.Env = append(append(os.Environ(), "TEST="+t.Name()), param.Env...)
if err := cmd.Run(); err != nil || param.ExitCode != 0 {
errExit := &exec.ExitError{}
if errors.As(err, &errExit) || err != nil {
require.Equal(t, param.ExitCode, errExit.ExitCode())
} else {
Expand Down

0 comments on commit 42cd032

Please sign in to comment.