cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rkn...@apache.org
Subject [1/2] cordova-medic git commit: CB-10671: Killing adb server as part of Android medic-kill step
Date Fri, 26 Feb 2016 21:38:48 GMT
Repository: cordova-medic
Updated Branches:
  refs/heads/master 9f8002bc6 -> cea6c852e


CB-10671: Killing adb server as part of Android medic-kill step


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

Branch: refs/heads/master
Commit: e583d860204fe02f633fcbfde6e5be2f29cc2e55
Parents: 9f8002b
Author: riknoll <richard.b.knoll@gmail.com>
Authored: Thu Feb 25 11:17:52 2016 -0800
Committer: riknoll <richard.b.knoll@gmail.com>
Committed: Thu Feb 25 11:23:49 2016 -0800

----------------------------------------------------------------------
 medic/medic-kill.js | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/e583d860/medic/medic-kill.js
----------------------------------------------------------------------
diff --git a/medic/medic-kill.js b/medic/medic-kill.js
index 2a77cde..934cdf1 100644
--- a/medic/medic-kill.js
+++ b/medic/medic-kill.js
@@ -49,6 +49,24 @@ function tasksOnPlatform(platformName) {
     }
 }
 
+/**
+ * CB-10671: In order to deal with issues where "ghost" emulators sometimes get
+ * left behind, we kill the ADB server
+ */
+function killAdbServer() {
+    util.medicLog("Killing adb server");
+    var killServerCommand = "adb kill-server";
+
+    util.medicLog("Running the following command:");
+    util.medicLog("    " + killServerCommand);
+
+    var killServerResult = shelljs.exec(killServerCommand, {silent: false, async: false});
+    if (killServerResult.code !== 0) {
+        util.fatal("Failed killing adb server");
+    }
+    util.medicLog("Finished killing adb server");
+}
+
 function getKillCommand(taskNames) {
 
     var cli;
@@ -76,11 +94,10 @@ function killTasks(taskNames) {
     util.medicLog("running the following command:");
     util.medicLog("    " + command);
 
-    shelljs.exec(command, {silent: false, async: true}, function (returnCode, output) {
-        if (returnCode !== 0) {
-            console.warn("WARNING: kill command returned " + returnCode);
-        }
-    });
+    var killTasksResult = shelljs.exec(command, {silent: false, async: false });
+    if (killTasksResult.code !== 0) {
+        console.warn("WARNING: kill command returned " + killTasksResult.code);
+    }
 }
 
 function killTasksForPlatform(platform) {
@@ -97,6 +114,10 @@ function killTasksForPlatform(platform) {
 
     // kill them
     killTasks(platformTasks);
+
+    if (platform === util.ANDROID) {
+        killAdbServer();
+    }
 }
 
 // main


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


Mime
View raw message