cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblotsky <...@git.apache.org>
Subject [GitHub] cordova-medic pull request: CB-10433: Removing the ETIMEDOUT error...
Date Sat, 13 Feb 2016 01:07:43 GMT
Github user dblotsky commented on a diff in the pull request:

    https://github.com/apache/cordova-medic/pull/76#discussion_r52818827
  
    --- Diff: medic/medic-run.js ---
    @@ -404,26 +459,51 @@ function main() {
             }
     
             // run the code
    -        // NOTE:
    -        //      this is ASYNCHRONOUS
             util.medicLog("running:");
             util.medicLog("    " + runCommandDevice);
    -        shelljs.exec(runCommandDevice, {silent: false, async: true}, function (returnCode,
output) {
    -            if (failedBecauseNoDevice(output)) {
    -                util.medicLog("no device found, so switching to emulator");
    +        var runDeviceResult = shelljs.exec(runCommandDevice, {silent: false, async: false});
    +
    +        if (failedBecauseNoDevice(runDeviceResult.output)) {
    +            util.medicLog("no device found, so switching to emulator");
    +
    +            // Because the Android emulator script uses promises, we need to
    +            // abstract the run step into a function
    +            var runOnEmulator = function() {
                     util.medicLog("running:");
                     util.medicLog("    " + runCommandEmulator);
    -                shelljs.exec(runCommandEmulator, {silent: false, async: true}, function
(returnCode, output) {
    -                    if (cordovaReturnedError(returnCode, output)) {
    -                        util.fatal("running on emulator failed");
    +
    +                var runEmulatorResult = shelljs.exec(runCommandEmulator, {silent: false,
async: false});
    +                if (cordovaReturnedError(runEmulatorResult.code, runEmulatorResult.output))
{
    +                    util.fatal("running on emulator failed");
    +                } else {
    +                    startPollingForTestResults(couchdbURI, buildId, timeout);
    +                }
    +            };
    +
    +            if (platform === util.ANDROID) {
    +                // We need to start the emulator first. We can't use "cordova run"
    --- End diff --
    
    Nitpick: please add a blank line before comments.


---
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


Mime
View raw message