Skip to content

Commit 8d535cc

Browse files
Copilotjeduden
andauthored
test: clarify parallel-unsafe comment on capture helpers
Agent-Logs-Url: https://github.com/jeduden/mdsmith/sessions/78e76067-7923-49ec-a0b7-529f908882c9 Co-authored-by: jeduden <1117699+jeduden@users.noreply.github.com>
1 parent 1efcf8c commit 8d535cc

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

cmd/mdsmith/main_unit_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import (
1919
)
2020

2121
// captureStderr temporarily redirects os.Stderr and returns the written content.
22-
// Not safe to call in parallel tests.
22+
// Must NOT be called from parallel tests (t.Parallel()) because it redirects
23+
// the global os.Stderr. Tests using this helper must run sequentially.
2324
func captureStderr(f func()) string {
2425
r, w, err := os.Pipe()
2526
if err != nil {
@@ -36,7 +37,8 @@ func captureStderr(f func()) string {
3637
}
3738

3839
// captureStdout temporarily redirects os.Stdout and returns the written content.
39-
// Not safe to call in parallel tests.
40+
// Must NOT be called from parallel tests (t.Parallel()) because it redirects
41+
// the global os.Stdout. Tests using this helper must run sequentially.
4042
func captureStdout(f func()) string {
4143
r, w, err := os.Pipe()
4244
if err != nil {

0 commit comments

Comments
 (0)