Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions pstack/skills/statechart/scripts/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,21 @@ async function signalWhile<T extends { dir: string; reached: (parent: string) =>

async function assertGone(pid: number) {
for (let i = 0; ; i++) {
let code: string | undefined;
try {
process.kill(pid, 0);
} catch (error) {
assert.equal((error as NodeJS.ErrnoException).code, "ESRCH");
return;
code = (error as NodeJS.ErrnoException).code;
// macOS gives EPERM for a process group of only zombies, until they are reaped.
if (code !== "EPERM") {
assert.equal(code, "ESRCH");
return;
}
}
assert.ok(i < 250, `Process ${pid} is still running.`);
assert.ok(
i < 250,
`Process ${pid} ${code ? "exited, but it was not reaped" : "is still running"}.`,
);
await sleep(20);
}
}
Expand Down
Loading