Created
May 15, 2025 07:34
Revisions
-
schickling created this gist
May 15, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ import { spawn } from 'node:child_process' import process from 'node:process' const run = (cmd: string, args: string[], forwardStdin = true) => spawn(cmd, args, { shell: true, stdio: [forwardStdin ? 'inherit' : 'ignore', 'inherit', 'inherit'], }) const processes = [ // Forward stdin to allow Vite keyboard input run('pnpm', ['run', 'dev:vite'], true), run('pnpm', ['run', 'dev:wrangler'], false), ] // Cleanly kill both on ^C or when either exits const shutdown = () => { for (const p of processes) { p.kill('SIGINT') } } process.on('SIGINT', shutdown).on('SIGTERM', shutdown) for (const p of processes) { p.on('exit', shutdown) }