From 6eaf8ca92f7e01d7cb87de6652ae2e69a2638913 Mon Sep 17 00:00:00 2001 From: jquense Date: Thu, 22 Jan 2015 22:25:36 -0500 Subject: [PATCH] use process exit listener instead of process.exit() ensures that console.log is fully flushed on Windows before exiting completely --- bin/jest.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/bin/jest.js b/bin/jest.js index 8a9ace582a1b..812d77d1e404 100755 --- a/bin/jest.js +++ b/bin/jest.js @@ -110,7 +110,12 @@ var argv = optimist if (argv.help) { optimist.showHelp(); - process.exit(0); + + process.on('exit', function(){ + process.exit(1); + }); + + return; } var cwd = process.cwd(); @@ -145,7 +150,12 @@ if (fs.existsSync(cwdJestBinPath)) { 'installed globally.\n' + 'Please upgrade this project past Jest version 0.1.5' ); - process.exit(1); + + process.on('exit', function(){ + process.exit(1); + }); + + return; } } else { // Otherwise, load this version of Jest. @@ -165,7 +175,12 @@ if (fs.existsSync(cwdJestBinPath)) { 'Please run `npm install` to use the version of Jest intended for ' + 'this project.' ); - process.exit(1); + + process.on('exit', function(){ + process.exit(1); + }); + + return; } } } @@ -175,5 +190,7 @@ if (!argv.version) { } jest.runCLI(argv, cwdPackageRoot, function (success) { - process.exit(success ? 0 : 1); + process.on('exit', function(){ + process.exit(success ? 0 : 1); + }); });