ITADN

Weird escaping in error message from process stderr

#1225OpenArden144 创建于 2026-01-29
A
Arden144commented
I've added execa in my project to replace a different child process wrapper and I'm having a weird issue with the error message when a subprocess exits with an error code. The following is an example of how I'm invoking execa: ```ts const subprocess = execa("pnpm", ["nonexistent", "command"], { cwd: "./some/dir", buffer: false, stdout: ["overlapped", "inherit"], stderr: ["overlapped", "inherit"], }); // Insert some usage of stdout and stderr here await subprocess; ``` And this is the resulting error thrown when the subprocess exits: ```ts Commandcharacter => escapeControlCharacter(character)failedcharacter => escapeControlCharacter(character)withcharacter => escapeControlCharacter(character)exitcharacter => escapeControlCharacter(character)codecharacter => escapeControlCharacter(character)254:character => escapeControlCharacter(character)pnpmcharacter => escapeControlCharacter(character)nonexistentcharacter => escapeControlCharacter(character)command at getFinalError (file:///{REDACTED}/node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/return/final-error.js:6:9) at makeError (file:///{REDACTED}/node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/return/result.js:108:16) at getAsyncResult (file:///{REDACTED}/node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/methods/main-async.js:168:4) at handlePromise (file:///{REDACTED}/node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/methods/main-async.js:151:17) ``` The actual message from the subprocess is there, just with `character => escapeControlCharacter(character)` interleaved between words. Node.js v20.19.6 Execa 9.6.1 pnpm 10.6.3 MacOS 26.2
0 条评论