chore(process): drop Bun spawn-encoding workaround (fixed upstream in oven-sh/bun#36050) (#114606)

This commit is contained in:
Peter Steinberger
2026-07-27 10:36:58 -04:00
committed by GitHub
parent 983468b13d
commit d2dc61cddf

View File

@@ -69,14 +69,6 @@ export function spawnCommandWithInvocation<
invocation: ReturnType<typeof resolveSafeChildProcessInvocation>;
} {
const { baseEnv, env, windowsVerbatimArguments, ...execaOptions } = options;
// Bun workaround (oven-sh/bun#36049): execa forwards its whole options object to
// child_process.spawn. Node ignores the extra `encoding` key there, but Bun's
// spawn feeds it into its stream constructor and throws ERR_UNKNOWN_ENCODING for
// execa's "buffer". Clearing it under Bun means buffered results arrive as utf8
// strings instead of Buffers; callers already normalize via Buffer.from. Binary-
// exact output paths are unverified under Bun. Remove once the Bun issue is fixed.
const dropBufferEncodingForBun =
Boolean(process.versions.bun) && execaOptions.encoding === "buffer";
const commandEnv = resolveCommandEnv({ argv, baseEnv, env });
const invocation = resolveSafeChildProcessInvocation({
argv,
@@ -86,7 +78,6 @@ export function spawnCommandWithInvocation<
});
const child = execa(invocation.command, invocation.args, {
...execaOptions,
...(dropBufferEncodingForBun ? { encoding: undefined } : {}),
env: commandEnv,
extendEnv: false,
shell: false,