Files
openclaw/src/process/exec.windows.integration.test.ts
mushuiyu886 4e11da2872 fix(process): UTF-8 command output corrupts at Windows byte limits (#105274)
* fix(process): preserve byte-capped UTF-8 output on Windows

* fix(process): skip codepage probe for UTF-8 output

Co-authored-by: 杨浩宇0668001029 <yang.haoyu@xydigit.com>

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-18 22:44:12 +01:00

25 lines
802 B
TypeScript

import process from "node:process";
import { describe, expect, it } from "vitest";
import { runUtf8CommandWithTimeout } from "./exec.js";
describe("runUtf8CommandWithTimeout Windows integration", () => {
it.runIf(process.platform === "win32")(
"keeps truncated UTF-8 head output on a code point boundary",
async () => {
const result = await runUtf8CommandWithTimeout(
[process.execPath, "-e", "process.stdout.write('a😀z'); process.stderr.write('b😀y')"],
{
maxOutputBytes: 3,
outputCapture: "head",
timeoutMs: 3_000,
},
);
expect(result.stdout).toBe("a");
expect(result.stderr).toBe("b");
expect(result.stdoutTruncatedBytes).toBe(5);
expect(result.stderrTruncatedBytes).toBe(5);
},
);
});