Commit d94cb5d
fbuild-core(subprocess): dedupe wait/kill, fix Windows PATH edge cases, add passthrough test
Three CodeRabbit findings in the new running-process-backed
subprocess module:
* The wait/timeout/kill/error-mapping block was duplicated verbatim
between `run_command_passthrough` and `run_captured`. Extract a
private `wait_or_kill()` helper so the contract (timeout kills the
child, errors flatten into `FbuildError::Timeout` / `::Other`)
lives in one place.
* `run_command_passthrough` had zero test coverage. Add a smoke test
that spawns `cmd /C exit 7` / `sh -c 'exit 7'` and asserts the
returned `i32` equals the child's real exit code (plus a 0 case).
* `compute_env` on Windows had two bugs:
1. `format!("{};{}", exe_dir_str, current_path)` produced a
trailing-semicolon `PATH` of `"exe_dir;"` whenever the inherited
`PATH` was empty. Guard the empty case explicitly.
2. The exe-dir prepend happened *before* `strip_msys_env`, and
`strip_msys_env` drops PATH entries containing `\msys`,
`/msys`, or `/usr/`. An exe_dir whose path contained one of
those substrings would therefore be silently stripped back
out. Reorder so `strip_msys_env` runs first and the exe_dir
prepend is applied to the already-cleaned PATH.
Addresses CodeRabbit review on #200.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent aec6df4 commit d94cb5d
1 file changed
Lines changed: 60 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
68 | 83 | | |
69 | 84 | | |
70 | 85 | | |
| |||
86 | 101 | | |
87 | 102 | | |
88 | 103 | | |
89 | | - | |
| 104 | + | |
90 | 105 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
203 | 211 | | |
204 | 212 | | |
205 | 213 | | |
| |||
211 | 219 | | |
212 | 220 | | |
213 | 221 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
218 | 228 | | |
219 | 229 | | |
220 | 230 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | 231 | | |
229 | 232 | | |
230 | 233 | | |
| |||
370 | 373 | | |
371 | 374 | | |
372 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
373 | 404 | | |
0 commit comments