cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblotsky <...@git.apache.org>
Subject [GitHub] cordova-android pull request: CB-10510: Add an optional timeout to...
Date Fri, 12 Feb 2016 20:40:54 GMT
Github user dblotsky commented on a diff in the pull request:

    https://github.com/apache/cordova-android/pull/258#discussion_r52795575
  
    --- Diff: bin/templates/cordova/lib/emulator.js ---
    @@ -227,18 +236,25 @@ module.exports.wait_for_emulator = function(uuid) {
     };
     
     /*
    - * Waits for the core android process of the emulator to start
    + * Waits for the core android process of the emulator to start. Returns a
    + * promise that resolves to a boolean indicating success. Not specifying a
    + * time_remaining or passing a negative value will cause it to wait forever
      */
    -module.exports.wait_for_boot = function(emulator_id) {
    +module.exports.wait_for_boot = function(emulator_id, time_remaining) {
         var self = this;
         return Adb.shell(emulator_id, 'ps')
         .then(function(output) {
             if (output.match(/android\.process\.acore/)) {
    -            return;
    +            return true;
    +        } else if (time_remaining === 0) {
    +            return false;
             } else {
                 process.stdout.write('.');
    -            return Q.delay(3000).then(function() {
    -                return self.wait_for_boot(emulator_id);
    +
    +            // Check at regular intervals
    +            return Q.delay(time_remaining < CHECK_BOOTED_INTERVAL ? time_remaining
: CHECK_BOOTED_INTERVAL).then(function() {
    --- End diff --
    
    Maybe use `Math.min` here instead of the ternary operator? It's a little hard to read
long ternary conditions.


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