run server
This commit is contained in:
parent
0c8c5c7387
commit
73691aacae
13
main.ts
13
main.ts
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user