Skip to content

Instantly share code, notes, and snippets.

@SaltyAom
Created April 7, 2024 13:09
Show Gist options
  • Save SaltyAom/c375433ffe7deffdce74db874168ba63 to your computer and use it in GitHub Desktop.
Save SaltyAom/c375433ffe7deffdce74db874168ba63 to your computer and use it in GitHub Desktop.
Spawn Bun server using multi-process
import { $ } from 'bun'
import { cpus } from 'os'
const total = cpus().length - 1
const ops = []
for (let i = 0; i < total; i++)
ops.push($`NODE_ENV=production bun example/a.ts`)
await Promise.all(ops)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment