run server

This commit is contained in:
Corey Johnson 2025-06-23 15:35:06 -07:00
parent 0c8c5c7387
commit 73691aacae
2 changed files with 13 additions and 2 deletions

13
main.ts
View File

@ -13,6 +13,11 @@ const run = async (cmd: string[]) => {
try {
const status = await proc.exited
console.log(`👋 Process ${commandText}(PID ${proc.pid}) exited with code ${status}`)
if (status !== 0) {
throw new Error(`Process "${commandText}" failed with exit code ${status}`)
}
return status
} catch (err) {
console.error(`💥 Error waiting for "${commandText}" exit:`, err)
@ -20,4 +25,10 @@ const run = async (cmd: string[]) => {
}
}
await Promise.all([run(["bun", "bot:discord"]), run(["bun", "http"])])
try {
await Promise.all([run(["bun", "bot:discord"]), run(["bun", "http"])])
console.log("✅ All processes completed successfully")
} catch (error) {
console.error("❌ One or more processes failed:", error)
process.exit(1)
}

View File

@ -17,6 +17,6 @@
"http": "bun run --filter=@workshop/http start",
"bot:cli": "bun run --filter=@workshop/spike bot:cli",
"bot:discord": "bun run --filter=@workshop/spike bot:discord",
"start": "bun run bot:discord"
"start": "bun run main.ts"
}
}