CB-5801 Add spawn work-around on windows for it not being able to execute .cmd files

More info: https://github.com/joyent/node/issues/2318
This commit is contained in:
Andrew Grieve 2014-01-16 12:11:31 -05:00
parent 4971670e56
commit 22e4039133

View File

@ -21,11 +21,17 @@
var child_process = require('child_process'),
Q = require('q');
var isWindows = process.platform.slice(0, 3) == 'win';
// Takes a command and optional current working directory.
module.exports = function(cmd, args, opt_cwd) {
var d = Q.defer();
try {
// Work around spawn not being able to find .bat files.
if (isWindows) {
args.unshift('/s', '/c', cmd);
cmd = 'cmd';
}
var child = child_process.spawn(cmd, args, {cwd: opt_cwd, stdio: 'inherit'});
child.on('exit', function(code) {
if (code) {