mirror of
https://github.com/SrIzan10/nodemon.git
synced 2026-05-01 10:55:09 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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()));
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user