From 8aafaa4953261e9443d4440b042f43541e14bed0 Mon Sep 17 00:00:00 2001 From: Glen Mailer Date: Thu, 5 Dec 2013 14:32:09 +0000 Subject: [PATCH] Ensure process exit code is preserved when using --no-exit --- bin/_mocha | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/_mocha b/bin/_mocha index 055e3ea1c0..32c82a06cc 100644 --- a/bin/_mocha +++ b/bin/_mocha @@ -348,7 +348,11 @@ if (program.watch) { // load mocha.files = files; -mocha.run(program.exit ? process.exit : function() {}); +mocha.run(program.exit ? process.exit : exitLater); + +function exitLater(code) { + process.on('exit', function() { process.exit(code) }) +} // enable growl notifications