| 23 | * `dist/` each run, so callers should push the result before building another. |
| 24 | */ |
| 25 | export const buildGuestBinary = async (os: VmOs, arch: VmArch): Promise<string> => { |
| 26 | const target = `executor-${PLATFORM_TAG[os]}-${arch}`; |
| 27 | await execFileP("bun", ["run", "src/build.ts", "binary", "--target", target], { |
| 28 | cwd: CLI_DIR, |
| 29 | maxBuffer: 256 * 1024 * 1024, |
| 30 | }); |
| 31 | const binDir = path.join(CLI_DIR, "dist", target, "bin"); |
| 32 | const exe = path.join(binDir, os === "windows" ? "executor.exe" : "executor"); |
| 33 | if (!existsSync(exe)) throw new Error(`buildGuestBinary: ${exe} not produced`); |
| 34 | return binDir; |
| 35 | }; |