From 3e66e456f4c612126053483508d89f4751966f45 Mon Sep 17 00:00:00 2001 From: malonecj Date: Wed, 6 Aug 2014 13:23:59 +0100 Subject: [PATCH] workaround for windows to ensure console.log is always flushed before process.exit --- bin/jest.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bin/jest.js b/bin/jest.js index a3db6e5f5dde..e9d17fd1e3a5 100755 --- a/bin/jest.js +++ b/bin/jest.js @@ -321,7 +321,9 @@ function _main(onComplete) { if (argv.help) { optimist.showHelp(); - process.exit(0); + process.on('exit', function(){ + process.exit(0); + }); } var cwd = process.cwd(); @@ -358,7 +360,9 @@ function _main(onComplete) { 'installed globally.\n' + 'Please upgrade this project past Jest version 0.1.5' ); - process.exit(1); + process.on('exit', function(){ + process.exit(1); + }); } jestBinary.runCLI(argv, cwdPackageRoot, onComplete); @@ -381,7 +385,9 @@ function _main(onComplete) { 'Please run `npm install` to use the version of Jest intended for ' + 'this project.' ); - process.exit(1); + process.on('exit', function(){ + process.exit(1); + }); } } @@ -396,6 +402,8 @@ exports.runCLI = runCLI; if (require.main === module) { harmonize(); _main(function (success) { - process.exit(success ? 0 : 1); + process.on('exit', function(){ + process.exit(success ? 0 : 1); + }); }); }