cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dase...@apache.org
Subject android commit: CB-11133 Handle android emulator start failure
Date Tue, 26 Apr 2016 16:59:36 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master 895166039 -> abcaee24f


CB-11133 Handle android emulator start failure


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/abcaee24
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/abcaee24
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/abcaee24

Branch: refs/heads/master
Commit: abcaee24f9bd0e680f8d06ced5e0d363d63cffb7
Parents: 8951660
Author: daserge <v-seshak@microsoft.com>
Authored: Thu Apr 21 15:52:56 2016 +0300
Committer: daserge <v-seshak@microsoft.com>
Committed: Tue Apr 26 19:54:34 2016 +0300

----------------------------------------------------------------------
 bin/templates/cordova/lib/emulator.js | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/abcaee24/bin/templates/cordova/lib/emulator.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/emulator.js b/bin/templates/cordova/lib/emulator.js
index bd85dcd..9aa4816 100644
--- a/bin/templates/cordova/lib/emulator.js
+++ b/bin/templates/cordova/lib/emulator.js
@@ -182,9 +182,26 @@ module.exports.start = function(emulator_ID, boot_timeout) {
         var uuidProp = 'emu.uuid=' + uuid;
         var args = ['-avd', emulatorId, '-prop', uuidProp];
         // Don't wait for it to finish, since the emulator will probably keep running for
a long time.
-        child_process
-            .spawn('emulator', args, { stdio: 'inherit', detached: true })
-            .unref();
+        var emulatorProcess = child_process
+            .spawn('emulator', args, { detached: true });
+
+        emulatorProcess.stderr.on('data', function (data) {
+            throw new CordovaError(data);
+        });
+
+        emulatorProcess.stdout.on('data', function (data) {
+            if (/ERROR/.test(data)) {
+                throw new CordovaError(data);
+            }
+        });
+
+        emulatorProcess.on('exit', function(code) {
+            if (code !== 0) {
+                throw new CordovaError('Emulator process exited with code: ' + code);
+            }
+        });
+
+        emulatorProcess.unref();
 
         // wait for emulator to start
         events.emit('log', 'Waiting for emulator...');


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message