diff --git a/appveyor.yml b/appveyor.yml index 5d3f9dec8..3cad5ff9c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,9 +7,9 @@ environment: install: - ps: Install-Product node $env:nodejs_version - set CI=true - - npm -g install npm@latest + - npm -g install npm@latest || (timeout 30 && npm -g install npm@latest) - set PATH=%APPDATA%\npm;%PATH% - - npm install + - npm install || (timeout 30 && npm install) matrix: fast_finish: true build: off @@ -19,4 +19,4 @@ clone_depth: 1 test_script: - node --version - npm --version - - npm run test-win + - npm run test-win || (timeout 30 && npm run test-win) diff --git a/lib/babel.js b/lib/babel.js index 78957dae3..c92b37b7d 100644 --- a/lib/babel.js +++ b/lib/babel.js @@ -46,6 +46,8 @@ if (!avaRequired) { process.on('message', function (message) { if (message['ava-kill-command']) { - process.exit(0); + setTimeout(function () { + process.exit(0); + }, 10); } }); diff --git a/lib/fork.js b/lib/fork.js index 8700b86a3..87bd5162a 100644 --- a/lib/fork.js +++ b/lib/fork.js @@ -67,11 +67,23 @@ module.exports = function (args) { ps.emit('data', data); }); - promise.on = function () { - ps.on.apply(ps, arguments); + var stdout = new Promise(function (resolve) { + ps.stdout.on('end', resolve); + }); + + var stderr = new Promise(function (resolve) { + ps.stderr.on('end', resolve); + }); + var endPromise = Promise.all([promise.reflect(), stdout, stderr]).then(function () { return promise; + }); + + endPromise.on = function () { + ps.on.apply(ps, arguments); + + return endPromise; }; - return promise; + return endPromise; };