Skip to content

Commit

Permalink
fix: clear execution interruption interval on first catch
Browse files Browse the repository at this point in the history
  • Loading branch information
lildeadprince authored and iiroj committed Apr 15, 2022
1 parent d327873 commit 46952cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/resolveTaskFn.js
Expand Up @@ -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)

Expand All @@ -67,7 +71,7 @@ const interruptExecutionOnError = (ctx, execaChildProcess) => {
}
}

const loopIntervalId = setInterval(loop, ERROR_CHECK_INTERVAL)
loopIntervalId = setInterval(loop, ERROR_CHECK_INTERVAL)

return () => {
clearInterval(loopIntervalId)
Expand Down

0 comments on commit 46952cb

Please sign in to comment.