This commit is contained in:
Corey Johnson 2025-06-16 16:53:57 -07:00
parent 9a898c0554
commit bb4fac2696
2 changed files with 24 additions and 1 deletions

22
main.ts Normal file
View File

@ -0,0 +1,22 @@
import { spawn } from "bun"
console.log(`Node Environment: ${process.env.NODE_ENV || "development"}`)
console.log(`Bun Version: ${Bun.version}`)
const run = async (cmd: string[]) => {
const commandText = cmd.join(" ")
console.log(`🆕 Starting process: ${commandText}`)
const proc = spawn(cmd, { stdout: "inherit", stderr: "inherit" })
console.log(`🪴 Spawned PID ${proc.pid} for ${commandText}`)
try {
const status = await proc.exited
console.log(`👋 Process ${commandText} (PID ${proc.pid}) exited with code ${status}`)
return status
} catch (err) {
console.error(`💥 Error waiting for ${commandText} exit:`, err)
throw err
}
}
await Promise.all([run(["bun", "bot:discord"]), run(["bun", "http"])])

View File

@ -11,6 +11,7 @@
"scripts": {
"http": "bun run --filter=@the-rabbit-hole/http start",
"bot:cli": "bun run --filter=@the-rabbit-hole/spike bot:cli",
"bot:discord": "bun run --filter=@the-rabbit-hole/spike bot:discord"
"bot:discord": "bun run --filter=@the-rabbit-hole/spike bot:discord",
"start": "bun run main.ts"
}
}