import { spawn } from 'node:child_process'; const env = { ...process.env, WIKIDECK_NETWORK: 'testnet', WIKIDECK_GENESIS_TIME: '1792411200', VITE_WIKIDECK_NETWORK: 'testnet', VITE_WIKIDECK_GENESIS_TIME: '1792411200' }; const children = [ spawn(process.execPath, ['--import', 'tsx', 'server/index.ts'], { env, stdio: 'inherit', shell: false }), spawn(process.execPath, ['node_modules/vite/bin/vite.js', '--host', '127.0.0.1'], { env, stdio: 'inherit', shell: false }), ]; let stopping = false; const stop = code => { if (stopping) return; stopping = true; for (const child of children) if (child.exitCode === null) child.kill('SIGTERM'); process.exitCode = code; }; for (const child of children) { child.once('error', () => stop(1)); child.once('exit', code => stop(code ?? 1)); } for (const signal of ['SIGINT', 'SIGTERM']) process.once(signal, () => stop(0));