Skip to content

Commit 52b53ad

Browse files
committed
fixup! refactor: remove tree-kill dependency and refactor killAllProcesses to use native childProc.kill with retries.
1 parent e985156 commit 52b53ad

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/e2e/utils/process.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,29 +261,28 @@ export async function waitForAnyProcessOutputToMatch(
261261
export async function killAllProcesses(signal: NodeJS.Signals = 'SIGTERM'): Promise<void> {
262262
let attempts = 0;
263263
const maxRetries = 3;
264-
const processes = [..._processes];
265264

266-
while (processes.length > 0 && attempts < maxRetries) {
265+
while (_processes.length > 0 && attempts < maxRetries) {
267266
attempts++;
268267

269268
// Iterate backwards so we can remove elements while looping if needed.
270-
for (let i = processes.length - 1; i >= 0; i--) {
271-
const childProc = processes[i];
269+
for (let i = _processes.length - 1; i >= 0; i--) {
270+
const childProc = _processes[i];
272271

273272
if (!childProc || childProc.killed) {
274-
processes.splice(i, 1);
273+
_processes.splice(i, 1);
275274
continue;
276275
}
277276

278277
const killed = childProc.kill(signal);
279278
if (killed) {
280-
processes.splice(i, 1);
279+
_processes.splice(i, 1);
281280
continue;
282281
}
283282
}
284283

285284
// If still have processes, wait a bit before the next retry (e.g., 100ms)
286-
if (processes.length > 0 && attempts < maxRetries) {
285+
if (_processes.length > 0 && attempts < maxRetries) {
287286
await sleep(100);
288287
}
289288
}

0 commit comments

Comments
 (0)