mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 01:41:21 +00:00
fix(process): preserve UTF-8 at diagnostic truncation boundaries (#8907)
* fix(process): preserve UTF-8 at diagnostic truncation boundaries * fix(process): preserve malformed UTF-8 excerpt evidence
This commit is contained in:
1 parent
a3621e5e1f
commit
3eff8065e7
3 files changed
+156
-3
No files matched your search
@@ -3,6 +3,22 @@ import { describe, expect, it } from "vitest";
|
||||
import { execFileBoundedOutput } from "./ExecFileBoundedOutput.js";
|
||||
|
||||
describe("execFileBoundedOutput", () => {
|
||||
it("retains complete UTF-8 characters at both sides of truncated command output", async () => {
|
||||
const text = `A🙂${"x".repeat(30)}🙂Z`;
|
||||
const result = await execFileBoundedOutput(
|
||||
process.execPath,
|
||||
[
|
||||
"-e",
|
||||
`process.stdout.write(${JSON.stringify(text)}); process.stderr.write(${JSON.stringify(text)});`,
|
||||
],
|
||||
{ env: {}, limit: 8 },
|
||||
);
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.stdout).toBe("A … [output omitted] … Z");
|
||||
expect(result.stderr).toBe("A … [output omitted] … Z");
|
||||
expect(result.outputTruncated).toBe(true);
|
||||
});
|
||||
|
||||
it("lets a command finish after its output exceeds the capture limit", async () => {
|
||||
const result = await execFileBoundedOutput(
|
||||
process.execPath,
|
||||
|
||||
Reference in new issue
Block a user