Repository navigation
Commit 18bb02a
fix(drivers): handle taskkill's async spawn error, and quote the last --prefix site
Fourth bot round on #1122, both findings against the previous commit.
**An unhandled `error` event could take the process down.** `killTree` wrapped
`spawn("taskkill", …)` in try/catch, but spawn reports a missing binary through
an asynchronous `error` event rather than a throw, so the catch never ran. An
unhandled `error` on a ChildProcess is fatal — meaning a Windows timeout could
kill the CLI while leaving the npm install it was trying to stop still running.
The killer now carries an `error` handler that falls back to killing the child
directly.
**A third `--prefix` site was still unquoted.** `installOptionalDriver`'s
npm-missing branch built its hint from the raw directory, so a user without npm
whose driver directory contains a space — a Windows profile, say — got a
copy-paste command that splits on it.
The test that should have caught that claimed "every printed --prefix is quoted"
while only ever exercising `DriverNotInstalledError`. It is replaced by
behavioural cases for each message-producing branch plus a structural check that
scans the sources and fails on any `--prefix ${…}` not wrapped in `shellQuote`.
Verified by adding a brand-new unquoted hint in an unrelated function: the
structural check fails, which is the failure mode that let this site through
twice.
Tests: 188 drivers unit (was 186), 4,696 opencode. Typecheck clean.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>1 parent 405a5ef commit 18bb02a
2 files changed
Lines changed: 58 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
| 407 | + | |
407 | 408 | | |
408 | | - | |
409 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
410 | 421 | | |
411 | 422 | | |
412 | 423 | | |
| |||
580 | 591 | | |
581 | 592 | | |
582 | 593 | | |
583 | | - | |
| 594 | + | |
584 | 595 | | |
585 | 596 | | |
586 | 597 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
587 | 603 | | |
588 | 604 | | |
589 | 605 | | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
596 | 628 | | |
| 629 | + | |
| 630 | + | |
597 | 631 | | |
598 | 632 | | |
0 commit comments