Commit 0e29f32
refactor(execute): decompose spawn into single-concern modules (#343)
## Summary
- Split the ~200-line `spawn()` in `session::execute::spawn` (which
mixed fspy/tokio command construction, Windows Job Object, FD_CLOEXEC
workaround, stdio piping, and cancellation) into four focused files
under `session::execute`:
- `spawn.rs` — now just abstracts fspy vs tokio, returning `ChildHandle
{ stdout, stderr, wait }` with a cancellation-aware `wait` future.
- `pipe.rs` — `pipe_stdio()` drains stdout/stderr, with optional capture
for cache replay. Houses `StdOutput` / `OutputKind`.
- `tracked_accesses.rs` — `TrackedPathAccesses::from_raw()` normalizes
raw fspy accesses. Houses `PathRead`.
- `win_job.rs` — Windows Job Object RAII, moved out of `mod.rs`.
- `execute_spawn` composes the pieces and measures duration end-to-end
(spawn no longer tracks time).
- Group pipe-mode state into a local `Pipe` enum (`Piped { stdio_config,
capture }` / `Inherited`) so related state lives in one variant. The
`Inherited` arm drops `stdio_config` eagerly, matching existing
behavior.
- Compute `SpawnStdio` directly from the cache/suggestion condition (no
intermediate `use_piped: bool`). `SpawnStdio` now derives
`Copy/Clone/PartialEq/Eq/Debug`.
## Test plan
- [x] `just check`
- [x] `just lint`
- [x] `cargo test` (all library/unit tests, including
`malformed_windows_drive_path_after_workspace_strip_is_ignored` which
moved with `normalize_tracked_workspace_path`)
- [x] `cargo test -p vite_task_bin --test e2e_snapshots` — full e2e
coverage (148 tests) exercising piped + fspy + cache miss/hit, inherited
stdio, cancellation/process-tree kill, and read/write-overlap not-cached
paths
- [ ] Cross-target lint: `just lint-linux` / `just lint-windows` (CI
will cover)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent d19333d commit 0e29f32
12 files changed
Lines changed: 697 additions & 597 deletions
File tree
- crates/vite_task/src/session
- cache
- execute
- reporter
- grouped
- interleaved
- labeled
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
0 commit comments