mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-03 00:51:33 +00:00
* 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>
25 lines
802 B
TypeScript
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);
|
|
},
|
|
);
|
|
});
|