Skip to content

Race condition in Pipe.Exec #193

Closed
@nclv

Description

@nclv
WARNING: DATA RACE
Read at 0x00c000036110 by goroutine 55:
  go/pkg/mod/github.com/bitfield/[email protected]/script.go:388 +0x1e9
  github.com/bitfield/script.(*Pipe).Filter.func1()
      go/pkg/mod/github.com/bitfield/[email protected]/script.go:484 +0xc7

Previous write at 0x00c000036110 by goroutine 49:
  github.com/bitfield/script.(*Pipe).WithStderr()
      go/pkg/mod/github.com/bitfield/[email protected]/script.go:887 +0x798

There seems to be a data race with stdErr when executing the following piece of code in parallel (test with errgroup).

stdOut := new(bytes.Buffer)
stdErr := new(bytes.Buffer)

if _, err := script.Exec(cmdLine).WithStdout(stdOut).WithStderr(stdErr).Stdout(); err != nil {
	return nil, err
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions