From 46952cb0306bb5b54d839f63aecff7288389b195 Mon Sep 17 00:00:00 2001 From: Xirtid Nepla Date: Fri, 15 Apr 2022 07:42:21 +0400 Subject: [PATCH] fix: clear execution interruption interval on first catch --- lib/resolveTaskFn.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/resolveTaskFn.js b/lib/resolveTaskFn.js index 77b093b1e..dcb6ad1d0 100644 --- a/lib/resolveTaskFn.js +++ b/lib/resolveTaskFn.js @@ -56,8 +56,12 @@ const handleOutput = (command, result, ctx, isError = false) => { * checks the context. */ const interruptExecutionOnError = (ctx, execaChildProcess) => { + let loopIntervalId + async function loop() { if (ctx.errors.size > 0) { + clearInterval(loopIntervalId) + const ids = await pidTree(execaChildProcess.pid) ids.forEach(process.kill) @@ -67,7 +71,7 @@ const interruptExecutionOnError = (ctx, execaChildProcess) => { } } - const loopIntervalId = setInterval(loop, ERROR_CHECK_INTERVAL) + loopIntervalId = setInterval(loop, ERROR_CHECK_INTERVAL) return () => { clearInterval(loopIntervalId)