Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

resolve #1548: ensure the environment's "node" executable is used

Christopher Hiller1430c2b5102e
diff --git a/bin/_mocha b/bin/_mocha
index a73c9540..190c9f04 100755
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -1,5 +1,3 @@
-#!/usr/bin/env node
-
/**
* Module dependencies.
*/
diff --git a/bin/mocha b/bin/mocha
index de5942ab..e82e0b6d 100755
--- a/bin/mocha
+++ b/bin/mocha
@@ -5,8 +5,9 @@
* when found, before invoking the "real" _mocha(1) executable.
*/
-var spawn = require('child_process').spawn
- , args = [ __dirname + '/_mocha' ];
+var spawn = require('child_process').spawn,
+ path = require('path'),
+ args = [process.execPath, path.join(__dirname, '_mocha')];
process.argv.slice(2).forEach(function(arg){
var flag = arg.split('=')[0];
@@ -47,7 +48,7 @@ process.argv.slice(2).forEach(function(arg){
}
});
-var proc = spawn(process.argv[0], args, { stdio: 'inherit' });
+var proc = spawn(args[0], args.slice(1), { stdio: 'inherit' });
proc.on('exit', function (code, signal) {
process.on('exit', function(){
if (signal) {