Path: blob/main/lang/bun/files/patch-src_codegen_bundle-modules.ts
46591 views
-- Replace Bun.spawnSync with async Bun.spawn in bundle-modules.1-- On FreeBSD linux compat layer, Bun.spawnSync with stdio:"pipe" fails2-- with EINVAL because pread() is not valid on pipes. Using async Bun.spawn3-- with Response.arrayBuffer() works correctly on FreeBSD linux compat.452026-04-27 07:15:02 UTC6+++ src/codegen/bundle-modules.ts7@@ -221,12 +221,22 @@ verbose("running: ", config_cli);8path.join(TMP_DIR, "modules_out"),9];10verbose("running: ", config_cli);11-const out = Bun.spawnSync({12+const _spawnProc = Bun.spawn({13cmd: config_cli,14cwd: process.cwd(),15env: process.env,16- stdio: ["pipe", "pipe", "pipe"],17+ stdio: ["ignore", "pipe", "pipe"],18});19+const [_spawnStdout, _spawnStderr] = await Promise.all([20+ new Response(_spawnProc.stdout).arrayBuffer(),21+ new Response(_spawnProc.stderr).arrayBuffer(),22+]);23+const _spawnExit = await _spawnProc.exited;24+const out = {25+ exitCode: _spawnExit,26+ stdout: Buffer.from(_spawnStdout),27+ stderr: Buffer.from(_spawnStderr),28+};29if (out.exitCode !== 0) {30console.error(out.stderr.toString());31process.exit(out.exitCode);323334