fix(process): preserve command completion and input ownership

This commit is contained in:
morluto committed 2026-10-27 07:55:16 +08:00
1 parent 8a47cbbcce
commit 7fa54e2d62
4 files changed
+229 -37

No files matched your search

+15
View File
@@ -53,6 +53,21 @@ it.each([undefined, "SIGTERM"] as const)(
},
);
it.each([undefined, "SIGTERM"] as const)(
"closes unused command input with stop signal %s",
async (stopSignal) => {
const result = await execFileOutput(
process.execPath,
[
"-e",
'process.stdin.resume(); process.stdin.on("end", () => process.stdout.write("input closed"));',
],
{ timeout: 2_000, ...(stopSignal === undefined ? {} : { stopSignal }) },
);
expect(result.stdout).toBe("input closed");
},
);
describe("execFileOutput", () => {
it("ignores non-Error and incomplete failure metadata", () => {
expect(execFileOutputFailure("failure")).toBeUndefined();