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
+4 -9
View File
@@ -2,6 +2,8 @@ import { execFile } from "node:child_process";
import { readFile } from "node:fs/promises";
import { promisify } from "node:util";
import { matchesOwnedProcessCommand } from "./ProcessCommandIdentity.js";
const execFileAsync = promisify(execFile);
/** Identity proof required before REA may signal an owned process group. */
@@ -318,7 +320,7 @@ const launcherIdentityFailure = (
return "owned launcher parent identity did not match";
if (
ownership.expectedCommand !== undefined &&
!commandMatches(launcher.command, ownership.expectedCommand)
!matchesOwnedProcessCommand(launcher.command, ownership.expectedCommand)
)
return "owned launcher command identity did not match";
return null;
@@ -471,7 +473,7 @@ export const observeOwnedProcessLineage = async (
);
if (
ownership.expectedCommand !== undefined &&
!commandMatches(launcher.command, ownership.expectedCommand)
!matchesOwnedProcessCommand(launcher.command, ownership.expectedCommand)
)
return unavailableLineage(
ownership,
@@ -553,10 +555,3 @@ const liveProcesses = (
members: readonly ProcessTableEntry[],
): readonly ProcessTableEntry[] =>
members.filter(({ state }) => !state.startsWith("Z"));
const commandMatches = (actual: string, expected: string): boolean => {
return (
actual.trim() === expected.trim() ||
actual.trim().startsWith(`${expected.trim()} `)
);
};