Skip to content
Source
Sign inSign up
pingdotgg/t3code

test(ssh): unreaped-server test no longer loses its zombie fixture #22427

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/22427/headmerged by juliusmarminge View on GitHub

Showing 1 changed file with 10 additions and 0 deletions.

x
0 of 1 viewed, 1 left
10 additions and 0 deletionspackages/ssh/src/tunnel.test.tsModified
View file
@@ -1450,6 +1450,16 @@
yield* parent.stdout.pipe(Stream.decodeText(), Stream.splitLines, Stream.runHead),
+ // Until the parent execs, the shell still reaps its children, and a child killed then
+ // never becomes a zombie. Wait for the parent to be the non-reaping sleep.
+ const parentExec = yield* runScript(home, [
+ "-c",
+ `attempt=0; while [ "$attempt" -lt 1000 ]; do
+ case "$(ps -o comm= -p ${parent.pid})" in *sleep) exit 0;; esac
+ attempt=$((attempt + 1))
+ done; exit 1`,
+ ]);
+ assert.equal(parentExec.exitCode, 0);
process.kill(zombie, "SIGKILL");
// SIGKILL delivery is asynchronous; establish the zombie fixture before launching.
const zombieState = yield* runScript(home, [