🎯 Changes#
Fixes #2153.
exec() decoded each stdout/stderr chunk on its own with d.toString('utf8'). When a pipe splits a multi-byte UTF-8 character across two reads, both halves become U+FFFD.
The fix calls setEncoding('utf8') on both streams. Node then decodes with a StringDecoder, which keeps a partial sequence until the rest arrives. spawn() already handles this with decodeStream. A truncated sequence at the end of the stream still comes out as U+FFFD, the same as spawn().
Test: a new case in local-process.test.ts writes the first byte of € to stdout and stderr, then the rest 50 ms later, and checks that exec() returns € for both. It mirrors the existing spawn() test.
Docs: not changed. This is a bug fix with no API change.
✅ Checklist#
🚀 Release Impact#
Summary by CodeRabbit#
- Bug Fixes
- Fixed
exec() output decoding so UTF-8 characters split across reads are returned correctly in both standard output and standard error.
coderabbitai[bot](GitHub profile, opens in a new tab) reviewed
bc2fdaef-a7f1-4190-b05f-8d35aede6795Reviewing files that changed from the base of the PR and between ec6611537b2a281a657b07fcadd0917665ef4ca7 and aa13cdfe1f78bc7b66a705579c403b165478ee24.
testing/e2e/src/routeTree.gen.tstesting/e2e/src/routes/api.sandbox-local-process-exec.tstesting/e2e/tests/sandbox-local-process-exec.spec.tsIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.