this will make it better

This commit is contained in:
Corey Johnson 2025-06-16 10:49:41 -07:00
parent 49cce47f4c
commit 9b87ef6999
2 changed files with 19 additions and 2 deletions

1
.bun-version Normal file
View File

@ -0,0 +1 @@
1.2.16

20
main.ts
View File

@ -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"])])