Commit 3339e02
fix(output): serialize whole flush, not per-line, in LinePrefixWriter
writeLine acquired/released the shared writeMu once per line, so a
single Write() call that produced multiple lines (e.g. a hook's
buffered "\r"-then-"\n" progress update) could have another node's
writer interleave a line in between, corrupting concurrent Terraform
node output. Hold writeMu for the entire flush instead.
Reproduced with `go test -race -count=200` on
TestExecuteTerraformConcurrentHooksUseNodeWriters, which was flaking
in CI (Acceptance Tests macos, job 92489708710); now passes 200/200.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 0200c64 commit 3339e02
1 file changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
84 | 95 | | |
85 | 96 | | |
86 | 97 | | |
| |||
95 | 106 | | |
96 | 107 | | |
97 | 108 | | |
98 | | - | |
| 109 | + | |
99 | 110 | | |
100 | 111 | | |
101 | 112 | | |
| |||
115 | 126 | | |
116 | 127 | | |
117 | 128 | | |
| 129 | + | |
118 | 130 | | |
119 | 131 | | |
120 | 132 | | |
121 | 133 | | |
122 | | - | |
123 | | - | |
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
| |||
0 commit comments