Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A255C18FC8 for ; Wed, 11 Nov 2015 22:22:16 +0000 (UTC) Received: (qmail 94637 invoked by uid 500); 11 Nov 2015 22:22:16 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 94591 invoked by uid 500); 11 Nov 2015 22:22:16 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 94579 invoked by uid 99); 11 Nov 2015 22:22:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2015 22:22:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 96511DFA0B; Wed, 11 Nov 2015 22:22:15 +0000 (UTC) From: dblotsky To: dev@cordova.apache.org Reply-To: dev@cordova.apache.org References: In-Reply-To: Subject: [GitHub] cordova-android pull request: CB-9971 Redirect gradlew stderr to c... Content-Type: text/plain Message-Id: <20151111222215.96511DFA0B@git1-us-west.apache.org> Date: Wed, 11 Nov 2015 22:22:15 +0000 (UTC) Github user dblotsky commented on a diff in the pull request: https://github.com/apache/cordova-android/pull/240#discussion_r44595632 --- 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 -- Fair enough. However if `superspawn` code has a bug and is updated, then this code will be out of date. It's better not to duplicate code and instead modify and reuse `superspawn`. --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org For additional commands, e-mail: dev-help@cordova.apache.org