From 73691aacae0851e1790b3ff58d86a841bfef3ee6 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 23 Jun 2025 15:35:06 -0700 Subject: [PATCH] run server --- main.ts | 13 ++++++++++++- package.json | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index 05f1d80..33adef3 100644 --- a/main.ts +++ b/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) +} diff --git a/package.json b/package.json index 05019be..62f1867 100644 --- a/package.json +++ b/package.json @@ -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" } } \ No newline at end of file