mirror of https://github.com/garrytan/gstack.git
sendCommand's ECONNRESET handler treats every dropped connection as a crash and restarts the daemon. But stop and restart are user-initiated shutdowns: the daemon intentionally closes the HTTP connection before the response body flushes (meta-commands.ts:423-433). The restart attempt sends stop again, the new daemon exits again, and retries >= 1 throws 'Server crashed twice in a row — aborting.' Fix: add a short-circuit check for command === 'stop' || command === 'restart' at the top of the ECONNRESET handler. When user-intended, call process.exit(0) to skip main()'s surrounding .catch(), which would print '[browse] fetch failed' and exit 1. 'command' is already in closure from sendCommand's signature (cli.ts:527). The recursive calls at cli.ts:596 and :613 pass 'command' explicitly. Daemon-side handlers (meta-commands.ts) are unchanged. No 'chore: rebuild' commit — CI's windows-setup-e2e.yml rebuilds browse binary on every push touching browse/src/cli.ts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| bin | ||
| scripts | ||
| src | ||
| test | ||
| PLAN-snapshot-dropdown-interactive.md | ||
| SKILL.md | ||
| SKILL.md.tmpl | ||