Skip to content

Commit 2893437

Browse files
test(ssh): unreaped-server test no longer loses its zombie fixture (#22427)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent be5a5cd commit 2893437

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎packages/ssh/src/tunnel.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,16 @@ server.listen(Number(flag("--port")), "127.0.0.1", () => {
14501450
yield* parent.stdout.pipe(Stream.decodeText(), Stream.splitLines, Stream.runHead),
14511451
),
14521452
);
1453+
// Until the parent execs, the shell still reaps its children, and a child killed then
1454+
// never becomes a zombie. Wait for the parent to be the non-reaping sleep.
1455+
const parentExec = yield* runScript(home, [
1456+
"-c",
1457+
`attempt=0; while [ "$attempt" -lt 1000 ]; do
1458+
case "$(ps -o comm= -p ${parent.pid})" in *sleep) exit 0;; esac
1459+
attempt=$((attempt + 1))
1460+
done; exit 1`,
1461+
]);
1462+
assert.equal(parentExec.exitCode, 0);
14531463
process.kill(zombie, "SIGKILL");
14541464
// SIGKILL delivery is asynchronous; establish the zombie fixture before launching.
14551465
const zombieState = yield* runScript(home, [

0 commit comments

Comments
 (0)