Commit 4570ddf
authored
feat: improve stdio handling with async writers (#160)
## Summary
Extends the existing "stdin suggestion" system to a full "stdio" system.
Previously, only stdin was conditionally inherited vs null. Now, all
three stdio FDs (stdin, stdout, stderr) are conditionally inherited vs
piped, and the reporter provides `Box<dyn AsyncWrite + Unpin>` streams
for receiving child process output.
## Changes
### New types and API
- **`StdioSuggestion`** replaces `StdinSuggestion` — two modes: `Piped`
(stdin=null, stdout/stderr piped into AsyncWrite streams) and
`Inherited` (all three inherited from parent)
- **`StdioConfig`** returned by `LeafExecutionReporter::start()` —
contains the suggestion plus `stdout_writer` and `stderr_writer` async
streams
- Removed `stdin_suggestion()` and `output(kind, content)` from
`LeafExecutionReporter` trait
- Removed `OutputKind` from `event.rs` (only `spawn.rs` keeps its own
`OutputKind`)
### Reporter changes
- Removed the `W` generic from all reporters (`PlainReporter`,
`LabeledReporterBuilder`, `LabeledGraphReporter`, `LabeledLeafReporter`,
`SharedReporterState`)
- Display output (command lines, summaries, errors) written directly to
`std::io::stdout()` using sync writes
- `tokio::io::stdout()` / `tokio::io::stderr()` provided as the
`AsyncWrite` streams in `StdioConfig`
- `PlainReporter` returns `tokio::io::sink()` writers when
`silent_if_cache_hit && is_cache_hit`
### Execution flow
- `spawn_with_tracking()` — stdin is always `Stdio::null()`, takes `&mut
dyn AsyncWrite` for stdout/stderr instead of an `on_output` callback
- New `spawn_inherited()` — inherits all three stdio FDs, no fspy
tracking, just `cmd.spawn()` + `wait()`
- Decision matrix: inherited mode only when suggestion is `Inherited`
AND `cache_metadata.is_none()` (caching fully disabled)
- Cache replay writes directly to `StdioConfig` writers
- In-process execution writes to `stdout_writer` from `StdioConfig`
### Test updates
- Updated 8 stdio suggestion unit tests to use `start()` + assert
`StdioConfig.suggestion`
- Updated `task-list` E2E "vp run in script" test: inner `vp run` now
sees a terminal (inherited stdout) and shows interactive selector — test
uses `expect-milestone` + Enter to select and run a task1 parent a6c49eb commit 4570ddf
File tree
71 files changed
+712
-343
lines changed- crates
- vite_task_bin/tests/e2e_snapshots/fixtures
- associate-existing-cache/snapshots
- builtin-different-cwd/snapshots
- builtin-non-zero-exit/snapshots
- cache-disabled/snapshots
- cache-miss-command-change/snapshots
- cache-miss-reasons/snapshots
- cache-subcommand/snapshots
- colon-in-name/snapshots
- e2e-env-test/snapshots
- e2e-lint-cache/snapshots
- exec-api/snapshots
- exit-codes/snapshots
- individual-cache-for-adt-args/snapshots
- individual-cache-for-envs/snapshots
- lint-dot-git/snapshots
- replay-logs-chronological-order/snapshots
- signal-exit/snapshots
- stdin-inheritance/snapshots
- stdio-detection
- packages/other
- snapshots
- task-list
- snapshots
- task-no-trailing-newline/snapshots
- task-select-truncate/snapshots
- task-select/snapshots
- topological-execution-order/snapshots
- vite-task-smoke/snapshots
- vite_task
- src/session
- execute
- reporter
- packages/tools
- src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
71 files changed
+712
-343
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 46 | | |
53 | 47 | | |
54 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
12 | | - | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | | - | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | | - | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
119 | | - | |
| 122 | + | |
| 123 | + | |
120 | 124 | | |
121 | 125 | | |
122 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
| |||
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
150 | | - | |
151 | | - | |
152 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
| |||
197 | 204 | | |
198 | 205 | | |
199 | 206 | | |
200 | | - | |
201 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
202 | 210 | | |
203 | | - | |
| 211 | + | |
204 | 212 | | |
205 | 213 | | |
206 | 214 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
214 | 221 | | |
215 | 222 | | |
216 | 223 | | |
| |||
220 | 227 | | |
221 | 228 | | |
222 | 229 | | |
223 | | - | |
224 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
225 | 265 | | |
226 | 266 | | |
227 | 267 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | 268 | | |
242 | 269 | | |
243 | 270 | | |
244 | 271 | | |
245 | 272 | | |
246 | 273 | | |
247 | 274 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 275 | + | |
| 276 | + | |
258 | 277 | | |
259 | 278 | | |
260 | 279 | | |
| |||
270 | 289 | | |
271 | 290 | | |
272 | 291 | | |
273 | | - | |
| 292 | + | |
274 | 293 | | |
275 | 294 | | |
276 | 295 | | |
| |||
315 | 334 | | |
316 | 335 | | |
317 | 336 | | |
318 | | - | |
| 337 | + | |
319 | 338 | | |
320 | 339 | | |
321 | 340 | | |
322 | 341 | | |
323 | 342 | | |
324 | 343 | | |
325 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
326 | 368 | | |
327 | 369 | | |
328 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
| 13 | + | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
60 | | - | |
| 59 | + | |
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
65 | | - | |
66 | | - | |
| 64 | + | |
| 65 | + | |
67 | 66 | | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
| 75 | + | |
| 76 | + | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 78 | + | |
82 | 79 | | |
83 | 80 | | |
84 | 81 | | |
| |||
92 | 89 | | |
93 | 90 | | |
94 | 91 | | |
95 | | - | |
| 92 | + | |
96 | 93 | | |
97 | 94 | | |
98 | 95 | | |
| |||
122 | 119 | | |
123 | 120 | | |
124 | 121 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | 122 | | |
144 | 123 | | |
145 | 124 | | |
146 | 125 | | |
147 | 126 | | |
148 | 127 | | |
149 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
150 | 144 | | |
151 | 145 | | |
152 | 146 | | |
153 | 147 | | |
154 | 148 | | |
155 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
156 | 165 | | |
157 | 166 | | |
158 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | | - | |
| 249 | + | |
251 | 250 | | |
252 | 251 | | |
253 | 252 | | |
| |||
392 | 391 | | |
393 | 392 | | |
394 | 393 | | |
395 | | - | |
| 394 | + | |
396 | 395 | | |
397 | 396 | | |
398 | 397 | | |
| |||
468 | 467 | | |
469 | 468 | | |
470 | 469 | | |
471 | | - | |
| 470 | + | |
472 | 471 | | |
473 | 472 | | |
474 | 473 | | |
| |||
0 commit comments