diff options
Diffstat (limited to 'src/os/exec/exec_test.go')
| -rw-r--r-- | src/os/exec/exec_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go index 9783a133ba..71a00494ad 100644 --- a/src/os/exec/exec_test.go +++ b/src/os/exec/exec_test.go @@ -1819,3 +1819,19 @@ func TestConcurrentExec(t *testing.T) { cancel() hangs.Wait() } + +// TestPathRace tests that [Cmd.String] can be called concurrently +// with [Cmd.Start]. +func TestPathRace(t *testing.T) { + cmd := helperCommand(t, "exit", "0") + + done := make(chan struct{}) + go func() { + out, err := cmd.CombinedOutput() + t.Logf("%v: %v\n%s", cmd, err, out) + close(done) + }() + + t.Logf("running in background: %v", cmd) + <-done +} |
