From 22e4039133470aea7802ff66636dd5839c4d4790 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 16 Jan 2014 12:11:31 -0500 Subject: [PATCH] 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 --- bin/templates/cordova/lib/spawn.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/templates/cordova/lib/spawn.js b/bin/templates/cordova/lib/spawn.js index cea7a06d..d5b0dce1 100644 --- a/bin/templates/cordova/lib/spawn.js +++ b/bin/templates/cordova/lib/spawn.js @@ -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) {