From 7a58c24582b6ee2ef7277bb5811b8fcd59445446 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 18 Mar 2021 22:53:04 +0100 Subject: [PATCH] MOD: start adb server beforehand --- src/lime/tools/AndroidHelper.hx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/lime/tools/AndroidHelper.hx b/src/lime/tools/AndroidHelper.hx index 95989e4d6..54235eaaf 100644 --- a/src/lime/tools/AndroidHelper.hx +++ b/src/lime/tools/AndroidHelper.hx @@ -303,20 +303,14 @@ class AndroidHelper if (System.hostPlatform != WINDOWS) { - var tempFile = System.getTemporaryFile(); - - System.runCommand('/bin', 'sh', ["-c", '${adbPath}${adbName} devices > ${tempFile}'], true, true); - - if (FileSystem.exists(tempFile)) - { - output = File.getContent(tempFile); - FileSystem.deleteFile(tempFile); - } - } - else - { - output = System.runProcess(adbPath, adbName, ["devices"], true, true); + /* + * using System.runProcess on *NIX platforms for `adb devices` usually + * hangs when adb also starts the server. + * To avoid this, we start the server beforehand + */ + System.runCommand(adbPath, adbName, ["start-server"], true); } + output = System.runProcess(adbPath, adbName, ["devices"], true, true); if (output != null && output != "") {