diff --git a/src/test/node.js b/src/test/node.js index e8c479fde..d20306eb2 100644 --- a/src/test/node.js +++ b/src/test/node.js @@ -1,3 +1,4 @@ +import os from 'os' import path from 'path' import { fileURLToPath } from 'url' import { execa } from 'execa' @@ -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() } })