test(process): check SIGHUP limitation through its exported owner constant

This commit is contained in:
Clark authored and Ysopwnable committed 2026-11-21 22:29:33 +01:00
1 parent 95dfbae68e
commit de44e5e273
3 files changed
+22 -11

No files matched your search

@@ -340,6 +340,10 @@ export const settleProcessCaptureJournal = async (
}
};
/** POSIX PTY capture limitation when same-group children remain running at target exit. */
export const POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION =
"The target runs as the capture PTY session leader; still-running children in its foreground process group receive terminal SIGHUP when it exits unless they leave the group or ignore SIGHUP.";
export const buildCaptureResult = (
options: CaptureResultOptions,
): PendingProcessCapture => {
@@ -393,9 +397,7 @@ export const buildCaptureResult = (
: []),
"Process trees are sampled and may omit short-lived descendants.",
...(options.manifest.platform !== "win32"
? [
"The target runs as the capture PTY session leader; still-running children in its foreground process group receive terminal SIGHUP when it exits unless they leave the group or ignore SIGHUP.",
]
? [POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION]
: []),
...(options.samplingPartial
? ["Process-tree sampling ended with an incomplete observation."]
@@ -4,7 +4,10 @@ import {
ProcessCaptureSnapshotFailure,
snapshotRoots,
} from "./FilesystemSnapshot.js";
import { buildCaptureResult } from "./ProcessCaptureLifecycle.js";
import {
buildCaptureResult,
POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION,
} from "./ProcessCaptureLifecycle.js";
import { readLinuxChildren } from "./LinuxProcessSampling.js";
import { TerminalRenderer } from "./TerminalRenderer.js";
import { processScenarioSchema } from "../../domain/process/processScenario.js";
@@ -364,14 +367,19 @@ it("records the PTY session-leader SIGHUP limitation on POSIX captures only", ()
eventJournal: [],
});
expect(POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION).toMatch(
/PTY session leader/iu,
);
expect(POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION).toMatch(/SIGHUP/u);
expect(POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION).toMatch(/group/iu);
for (const posixPlatform of ["linux", "darwin"]) {
expect(buildForPlatform(posixPlatform).limitations).toContain(
"The target runs as the capture PTY session leader; still-running children in its foreground process group receive terminal SIGHUP when it exits unless they leave the group or ignore SIGHUP.",
POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION,
);
}
expect(
buildForPlatform("win32").limitations.some((line) =>
line.includes("SIGHUP"),
),
).toBe(false);
const winLimitations = buildForPlatform("win32").limitations;
expect(winLimitations).not.toContain(
POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION,
);
expect(winLimitations.some((line) => line.includes("SIGHUP"))).toBe(false);
});
@@ -9,6 +9,7 @@ import {
createRunManifest,
observeLaunchedExecutable,
observeSelectedExecutable,
POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION,
} from "../../../src/process/capture/ProcessCaptureLifecycle.js";
import {
accountFullyObservedProcessCapture,
@@ -230,6 +231,6 @@ it("projects the PTY session-leader SIGHUP limitation onto process capture Evide
});
const evidence = createProcessCaptureEvidence(scenario, capture);
expect(evidence.limitations).toContain(
"The target runs as the capture PTY session leader; still-running children in its foreground process group receive terminal SIGHUP when it exits unless they leave the group or ignore SIGHUP.",
POSIX_PTY_SESSION_LEADER_SIGHUP_LIMITATION,
);
});