Commit b4689d1
committed
Keep browse daemons alive across separate CLI invocations on macOS
The browse CLI was starting a server that looked healthy during the first
command, but the daemon and its Chromium children were still tied to the
launching shell session. A follow-up invocation would miss the prior server,
start from about:blank, and lose all persisted browse state.
This switches the POSIX launcher to a detached Node child that starts Bun in a
separate session/process group, and adds explicit SIGHUP handling on the server
side so headless daemons stay alive when short-lived shells exit. It also adds a
small regression guard around the detached stdio contract.
Constraint: The fix must work with Bun-built CLI binaries on macOS without adding dependencies
Rejected: Keep using Bun.spawn(...).unref() | daemon and Chromium still died after the launching shell exited
Rejected: nohup wrapper only | shell hangup still dropped the launched browser session in practice
Confidence: medium
Scope-risk: moderate
Reversibility: clean
Directive: Detached launch behavior is part of browse state persistence; do not revert to parent-attached spawn without re-testing separate invocations
Tested: bun test test/browse-cli-daemon.test.ts; bun run build; manual browse goto https://example.com then separate browse url reuse check
Not-tested: Full /qa and /canary flows on macOS after prolonged idle periods1 parent 656df0e commit b4689d1
3 files changed
Lines changed: 58 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
| |||
231 | 242 | | |
232 | 243 | | |
233 | 244 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
240 | 256 | | |
241 | 257 | | |
242 | 258 | | |
| |||
251 | 267 | | |
252 | 268 | | |
253 | 269 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
274 | 277 | | |
| 278 | + | |
| 279 | + | |
275 | 280 | | |
276 | 281 | | |
277 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1489 | 1489 | | |
1490 | 1490 | | |
1491 | 1491 | | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
1492 | 1510 | | |
1493 | 1511 | | |
1494 | 1512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments