Skip to content

Commit

Permalink
CB-5801 Add spawn work-around on windows for it not being able to exe…
Browse files Browse the repository at this point in the history
…cute .cmd files

More info: nodejs/node-v0.x-archive#2318
  • Loading branch information
agrieve committed Jan 16, 2014
1 parent b31b9ad commit 58013a9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cordova/lib/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 58013a9

Please sign in to comment.