mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 08:24:46 +00:00
test(terminal): observe original process completion after exit (#8892)
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
This commit is contained in:
@@ -270,6 +270,16 @@ describe.skipIf(isPlatform("win32"))("terminal worker reaper", () => {
|
||||
await reapTerminalWorkers({ paseoHome: home, inspector, gracefulMs: 0 });
|
||||
|
||||
expect(isAlive(unrelated.pid!)).toBe(true);
|
||||
// Completion means the recorded process is gone, even if its PID is occupied.
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
!isAlive(original.pid) ||
|
||||
classifyTerminalProgramProcess(original, await inspector.inspect(original.pid)).status ===
|
||||
"unrelated",
|
||||
{ timeout: 10000 },
|
||||
)
|
||||
.toBe(true);
|
||||
expect(existsSync(recordPath)).toBe(false);
|
||||
expect(
|
||||
classifyTerminalProgramProcess(original, await inspector.inspect(original.pid)),
|
||||
|
||||
@@ -867,7 +867,18 @@ it.each([false, true])(
|
||||
writeFileSync(exitRequestPath, "");
|
||||
await waitForCondition(() => first.getTerminal(ending.id) === undefined, 10000);
|
||||
expect(existsSync(exitObservedPath)).toBe(true);
|
||||
expect(isProcessAlive(endingPid)).toBe(false);
|
||||
const originalEnding = record!.terminals.find((entry) => entry.id === ending.id)!;
|
||||
// Exit delivery does not reserve the PID. Wait for the original process to
|
||||
// disappear, allowing Windows to reuse its PID just as in the restart check below.
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
!isProcessAlive(endingPid) ||
|
||||
classifyTerminalProgramProcess(originalEnding, await inspector.inspect(endingPid))
|
||||
.status === "unrelated",
|
||||
{ timeout: 10000 },
|
||||
)
|
||||
.toBe(true);
|
||||
} finally {
|
||||
if (recordFd !== null) closeSync(recordFd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user