Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-android/pull/240#discussion_r44586855 --- 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 + '"'; --- End diff -- This escaping works exactly the same way in `superspawn` and we hadn't had any problems with whitespaces, caused by this implementation, for a long time, so i'd prefer just not to change it.
--- 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