Github user dblotsky commented on a diff in the pull request: https://github.com/apache/cordova-android/pull/240#discussion_r44566085 --- Diff: bin/templates/cordova/lib/builders/GradleBuilder.js --- @@ -211,3 +209,46 @@ module.exports = GradleBuilder; function isAutoGenerated(file) { return fs.existsSync(file) && fs.readFileSync(file, 'utf8').indexOf(MARKER) > 0; } + +/** + * A special superspawn-like implementation, required to workaround the issue + * with java printing some necessary information to stderr instead of stdout. + * This function redirects all stderr messages to current process stdout. See + * https://issues.apache.org/jira/browse/CB-9971 for explanation. + * + * @param {String} cmd A command to spawn + * @param {String[]} args Command arguments. Note that on Windows arguments + * will be concatenated into string and passed to 'cmd.exe' along with '/s' + * and '/c' swithces for proper space-in-path handling + * + * @return {Promise} A promise, rejected with error message, if + * underlying command exits with nonzero exit code, fulfilled otherwise + */ +function spawnWithStderrRedirect(cmd, args) { + return Q.Promise(function (resolve, reject) { + // Work around spawn not being able to find .bat files. + var opts = { stdio: [0,1,1] }; + if (process.platform === 'win32') { + var joinedArgs = [cmd] + .concat(args) + .map(function(a){ + if (/^[^"].* .*[^"]/.test(a)) return '"' + a + '"'; + return a; + }) + .join(' '); + + args = ['/s', '/c'].concat('"' + joinedArgs + '"')/*, '"' + [cmd].concat(args).map(function(a){if (/^[^"].* .*[^"]/.test(a)) return '"' + a + '"'; return a;}).join(' ')+'"']*/; --- End diff -- Is the comment at the end of the line necessary?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org