spawn: Change node version checking logic

This change allows nodemon to properly work with all versions of io.js.
This fixes #509
This commit is contained in:
Jim Anders
2015-04-16 09:31:10 -04:00
parent 1f01aaaa7a
commit 22aa5146f3
2 changed files with 8 additions and 6 deletions

View File

@@ -2,7 +2,6 @@
var utils = require('./utils'),
merge = utils.merge,
bus = utils.bus,
nodeMajor = parseInt((process.versions.node.split('.') || [null,null])[1] || 0, 10),
childProcess = require('child_process'),
_spawn = childProcess.spawn;
@@ -37,7 +36,7 @@ module.exports = function spawn(command, config, eventArgs) {
args = command.join(' ');
if (nodeMajor >= 8) {
if (utils.version.major >= 1 || utils.version.minor >= 8) {
var env = merge(process.env, { FILENAME: eventArgs[0] } );
child = _spawn(sh, [shFlag, args], {
env: merge(config.options.execOptions.env, env),
@@ -68,4 +67,4 @@ module.exports = function spawn(command, config, eventArgs) {
bus.stderr = child.stderr;
}
}
};
};

View File

@@ -53,8 +53,11 @@ function ignore(rule, done, file) {
}
describe('nodemon ignore', function () {
after(function () {
files.forEach(fs.unlink);
after(function (done) {
files.forEach(function(file) {
fs.unlink(file, function() {});
});
done();
});
it('should be controlled via cli', function (done) {
@@ -65,4 +68,4 @@ describe('nodemon ignore', function () {
ignore(null, done, path.join(process.cwd(), 'node_modules', 'connect', 'node_modules', randomFile()));
});
});
});