From 9b87ef6999ee2a32a83dd8f6f6d5d4568839559b Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 16 Jun 2025 10:49:41 -0700 Subject: [PATCH] this will make it better --- .bun-version | 1 + main.ts | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .bun-version diff --git a/.bun-version b/.bun-version new file mode 100644 index 0000000..a96f385 --- /dev/null +++ b/.bun-version @@ -0,0 +1 @@ +1.2.16 \ No newline at end of file diff --git a/main.ts b/main.ts index c214fdc..f6d8252 100644 --- a/main.ts +++ b/main.ts @@ -1,6 +1,22 @@ -#!/usr/bin/env bun import { spawn } from "bun" -const run = (cmd: string[]) => spawn(cmd, { stdout: "inherit", stderr: "inherit" }).exited +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"])])