Repository navigation
Commit 393d72a
committed
fix(windows): stop the service wrapper killer using the argv Bun rejects
src/service.ts spawned PowerShell with "-WindowStyle", "Hidden" as argv
elements. src/codex/user-identity.ts:222-224 already forbids exactly that:
Bun 1.3.14 can fail the direct CLI pair before the command runs (#1589), and
the process-level windowsHide flag is what actually suppresses the window.
The call is not decorative. stopServiceIfInstalled() uses it because
schtasks /end can leave the wscript.exe/cmd.exe wrapper alive to respawn the
proxy, and it ignores spawnSync's exit status. Under #1589 wrapper termination
silently does nothing, so ocx stop, restart and update report success without
sticking.
The invariant survived as prose plus a single-file assertion:
tests/windows-deploy-close-regressions.test.ts:43 pins the argv only for
src/update/job.ts (the variable is bound at line 13), so service.ts was never
covered. Replaced with a sweep over every src/**/*.ts, which found exactly one
offender.
The sweep matches the argv form only. Six call sites legitimately pass
-WindowStyle Hidden inside a PowerShell script string handed to Start-Process
(windows-elevation.ts 622/660/687/736, tray/windows.ts:489, update/job.ts:574);
Bun never parses those. A second test pins that discrimination in both
directions so the sweep cannot quietly become vacuous or start failing correct
code.
Driven red first: the sweep reported ["service.ts"] before the fix.
Verification: bun test tests/windows-popup-fix.test.ts (7 pass), bun test
tests/service.test.ts tests/windows-deploy-close-regressions.test.ts
(131 pass), bun run typecheck clean.1 parent 4ef1fca commit 393d72a
2 files changed
Lines changed: 50 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2358 | 2358 | | |
2359 | 2359 | | |
2360 | 2360 | | |
2361 | | - | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
2362 | 2365 | | |
2363 | 2366 | | |
2364 | 2367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
0 commit comments