From 60a33fa0fdf534018105389a624a203c1b5cb29f Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Mon, 12 Sep 2022 23:57:50 +0300 Subject: [PATCH] CR --- test/sequential/test-watch-mode.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/sequential/test-watch-mode.mjs b/test/sequential/test-watch-mode.mjs index e003d6287ac30b..55098cf4be1692 100644 --- a/test/sequential/test-watch-mode.mjs +++ b/test/sequential/test-watch-mode.mjs @@ -15,6 +15,7 @@ if (common.isIBMi) common.skip('IBMi does not support `fs.watch()`'); function restart(file) { + // To avoid flakiness, we save the file repeatedly until test is done writeFileSync(file, readFileSync(file)); const timer = setInterval(() => writeFileSync(file, readFileSync(file)), 100); return () => clearInterval(timer); @@ -48,6 +49,7 @@ async function spawnWithRestarts({ if (restartsCount >= restarts) { cancelRestarts?.(); if (!child.kill()) { + // If failed to kill, kill forcefully setTimeout(() => child.kill('SIGKILL'), 1); } return;