this will make it better
This commit is contained in:
parent
49cce47f4c
commit
9b87ef6999
1
.bun-version
Normal file
1
.bun-version
Normal file
|
|
@ -0,0 +1 @@
|
|||
1.2.16
|
||||
20
main.ts
20
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"])])
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user