Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition on commands with pipes and an error #7

Open
dlm opened this issue Oct 16, 2024 · 0 comments
Open

Race condition on commands with pipes and an error #7

dlm opened this issue Oct 16, 2024 · 0 comments

Comments

@dlm
Copy link

dlm commented Oct 16, 2024

Given the file main.go with contents:

package main

import "os"

func main() {
	os.Exit(1)
}

and the file main_test.go with contents:

package main_test

import (
        "testing"
        "github.com/ionrock/procs"
)

func TestIt(t *testing.T) {
        p := procs.NewProcess("echo 4 + 3 | go run main.go")

        if err := p.Start(); err != nil {
                t.Fatalf("running: %s", err.Error())
        }

        if err := p.Wait(); err != nil {
                t.Fatalf("running: %s", err.Error())
        }
}

When I run the command:

go test -race ./main_test.go

I receive an error that there is a race condition.

@dlm dlm changed the title Race condition Race condition on commands with pipes and an error Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant