Skip to content

Commit

Permalink
fix: use taskkill to kill stuck coverage process on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Nov 2, 2023
1 parent a58f732 commit a49d572
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/test/node.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os from 'os'
import path from 'path'
import { fileURLToPath } from 'url'
import { execa } from 'execa'
Expand Down Expand Up @@ -115,9 +116,18 @@ export default async function testNode (argv, execaOptions) {
console.warn(kleur.red('!!! Collecting coverage has hung, killing process')) // eslint-disable-line no-console
console.warn(kleur.red('!!! See https://github.com/ipfs/aegir/issues/1206 for more information')) // eslint-disable-line no-console
killedWhileCollectingCoverage = true
proc.kill('SIGTERM', {
forceKillAfterTimeout: 1000
})

if (os.platform() === 'win32') {
// SIGTERM/SIGKILL doesn't work reliably on windows
execa('taskkill', ['/F', '/pid', `${proc.pid}`])
.catch(err => {
console.error('Could not kill process with PID', proc.pid, err) // eslint-disable-line no-console
})
} else {
proc.kill('SIGTERM', {
forceKillAfterTimeout: 1000
})
}
}, argv.covTimeout).unref()
}
})
Expand Down

0 comments on commit a49d572

Please sign in to comment.