title: Promises out of order
body: <p>I have a promise nested inside of another promise looking like this:</p>
  
  <pre><code> adb.screencap(list, id).then(function(missing) {
       adb.getScreens(list, id).then(function () {
           res.render('screencap', {output: "Screens captured."})
       })
   })
  </code></pre>
  
  <p>Where adb.screencap and adb.getScreens is: </p>
  
  <pre><code>adb.screencap = function(list, id){
      return new Promise(function (resolve, reject) {
          var array = new Array();
          var promises = new Array();
  
          for (var i = 0; i &lt; list.length; i++) {
              var cmd = "adb -s " + list[i] + " shell screencap /sdcard/" + list[i] + "-" + id + ".png";
              var missing = new Array();
  
              console.log("== " + cmd);
              promises.push(adb.openArray(i, array, list, cmd, missing));
          }
          Promise.all(promises).then(function (missing) {
              console.log(("resolve"));
              resolve(missing);
          })
      })
  }
  adb.getScreens = function(list, id){
      return new Promise(function (resolve, reject){
          for (var i = 0; i &lt; list.length; i++) {
              var cmd = 'adb -s ' + list[i] + ' pull /sdcard/' + list[i] + "-" + id + ".png /home/IdeaProjects/DeviceServer/public/files/" + list[i] + "-" + id + ".png";
              exec(cmd, function (err, stdout, stderr) {
                  console.log(stdout);
                  console.log(cmd);
              });
          }
          resolve();
      })
  }
  </code></pre>
  
  <p>Is there any reason why the adb.getScreens promise is completing before the adb.screencap promise?</p>