Repository navigation
bun run dev: run the servers with bun run --parallel - #48
Conversation
scripts/dev.ts supervised the server and the UI by hand: process groups of their own, signal handlers, SIGSTOP/SIGCONT for Ctrl+Z. The terminal already sends Ctrl+C, Ctrl+Z and hangup to the whole foreground process group, and `bun run --parallel` runs scripts side by side with prefixed output and stops the others when one fails. So `dev` is now `bun scripts/dev-prepare.ts && bun run --parallel dev:server dev:ui`. scripts/dev-prepare.ts keeps the rest of what dev.ts did: .env from .env.example on the first run, the plugin build (aborting before any server starts), the hint with the UI URL and login. HAUL_DEV_UI needs no default in the script any more: .env.example has carried it since the variable exists, and both Bun and the server read .env. dev.test.ts tested the supervisor and goes with it; dev-prepare.test.ts covers the prepare step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3rdfbWb1xDUdPRng7TX9Z
--parallel pipes each script's output (for the name prefix) and gives it /dev/null as input, so neither server sees a terminal: cargo and Vite (picocolors checks stdout.isTTY or FORCE_COLOR) dropped the colours that scripts/dev.ts kept by passing the terminal on. In a terminal `dev` now sets FORCE_COLOR and CARGO_TERM_COLOR; with its output in a pipe nothing is forced. scripts/dev-run.test.ts runs the `dev` script in a pty (Bun.spawn terminal) and in a pipe with server stand-ins. Vite's keyboard shortcuts need a terminal on stdin and stay with `bun run dev:ui`; the docs say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3rdfbWb1xDUdPRng7TX9Z
scripts/dev.ts forwarded SIGTERM, SIGINT and SIGHUP to both servers' process groups. `bun run --parallel` does not: SIGTERM or SIGHUP to the `bun run dev` pid (`kill <pid>`, an IDE's stop outside a terminal) ends it and orphans cargo/haul and Vite with their children, SIGINT is ignored. Signals from the terminal reach the whole foreground group and are fine. No process supervisor by decision, so the docs say how to stop them instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3rdfbWb1xDUdPRng7TX9Z
TDD reviewTwo regressions compared with the old 1. cargo and Vite lose their colours (and Vite its keyboard shortcuts)File: Red on 7932b3a: A pty probe confirmed it: both stand-ins report 2. A signal to the
|
|
TDD-Review abgeschlossen: Farben unter Generated by Claude Code |
Replaces the hand-written process supervisor
scripts/dev.ts(#47: process groups, own signal handlers, SIGSTOP/SIGCONT) with Bun's built-inbun run --parallel.bun run --parallelruns both scripts with Foreman-style prefixed output and stops the other script when one fails.scripts/dev-prepare.ts(12 lines, no process handling) does the rest of what dev.ts did: it creates.envfrom.env.exampleon the first run, builds the plugins (and aborts before any server starts if that fails), and prints the hint with the UI URL and login.HAUL_DEV_UIgets no default in the script..env.examplehas had it since the variable was added (4dec48b), and both Bun and the server (dotenvy) read.env. A${HAUL_DEV_UI-…}default would also break under Bun's own shell (--shell=bun, the default on Windows), which passes it through literally.scripts/dev.test.tstested the supervisor and is removed along with it.scripts/dev-prepare.test.tscovers the prepare step: it creates.env, keeps an existing one, and passes the plugin build's failure on. The roottestscript anddocs/development.mdare updated.Checked in a real pty (interactive bash), Bun 1.4.4
These runs used stand-ins for
cargo(on PATH) and the UI script. Each stand-in starts a child of its own.HAUL_DEV_UI=http://localhost:5173from the freshly created.env.T, and the shell takes input again.fgresumes all of them, and a following Ctrl+C leaves nothing.sleepchild, the accepted case.bun run devthen reports exit code 130, not 3.cargo run -p haulplus Vite, once (on other ports throughHAUL_LISTEN): both came up, and Ctrl+C left nothing.bun run testandbun run typecheckpass.Generated by Claude Code