Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports
Path: blob/main/lang/bun/files/patch-src_codegen_bundle-modules.ts
46591 views
1
-- Replace Bun.spawnSync with async Bun.spawn in bundle-modules.
2
-- On FreeBSD linux compat layer, Bun.spawnSync with stdio:"pipe" fails
3
-- with EINVAL because pread() is not valid on pipes. Using async Bun.spawn
4
-- with Response.arrayBuffer() works correctly on FreeBSD linux compat.
5
6
2026-04-27 07:15:02 UTC
7
+++ src/codegen/bundle-modules.ts
8
@@ -221,12 +221,22 @@ verbose("running: ", config_cli);
9
path.join(TMP_DIR, "modules_out"),
10
];
11
verbose("running: ", config_cli);
12
-const out = Bun.spawnSync({
13
+const _spawnProc = Bun.spawn({
14
cmd: config_cli,
15
cwd: process.cwd(),
16
env: process.env,
17
- stdio: ["pipe", "pipe", "pipe"],
18
+ stdio: ["ignore", "pipe", "pipe"],
19
});
20
+const [_spawnStdout, _spawnStderr] = await Promise.all([
21
+ new Response(_spawnProc.stdout).arrayBuffer(),
22
+ new Response(_spawnProc.stderr).arrayBuffer(),
23
+]);
24
+const _spawnExit = await _spawnProc.exited;
25
+const out = {
26
+ exitCode: _spawnExit,
27
+ stdout: Buffer.from(_spawnStdout),
28
+ stderr: Buffer.from(_spawnStderr),
29
+};
30
if (out.exitCode !== 0) {
31
console.error(out.stderr.toString());
32
process.exit(out.exitCode);
33
34