fix(process): normalize macOS launcher identity

This commit is contained in:
morluto
2026-07-24 03:38:25 +00:00
parent 13f3372a8b
commit 9c3aec8131
3 changed files with 53 additions and 9 deletions
+25
View File
@@ -9,6 +9,7 @@ import {
type ProcessOwnershipHost,
type WindowsProcessTreeHost,
} from "../src/process/ProcessOwnership.js";
import { matchesOwnedProcessCommand } from "../src/process/ProcessCommandIdentity.js";
const ownership = {
runId: "run-token",
@@ -61,6 +62,30 @@ describe("owned process-group cleanup", () => {
).toEqual({ REA_PROCESS_RUN_ID: "owned", EMPTY: "" });
});
it("matches macOS executable names after process-table normalization", () => {
expect(
matchesOwnedProcessCommand(
"node /tmp/fake-launcher.mjs",
"/opt/node/bin/node",
"darwin",
),
).toBe(true);
expect(
matchesOwnedProcessCommand(
"node /tmp/fake-launcher.mjs",
"/opt/python/bin/python3",
"darwin",
),
).toBe(false);
expect(
matchesOwnedProcessCommand(
"node /tmp/fake-launcher.mjs",
"/opt/node/bin/node",
"linux",
),
).toBe(false);
});
it("signals only a group whose every member carries the run token", async () => {
const { adapter, signalGroup } = host({
100: { REA_PROCESS_RUN_ID: "run-token" },