MOD: start adb server beforehand

This commit is contained in:
Alan
2021-03-18 22:53:04 +01:00
committed by Joshua Granick
parent 5c94adecd3
commit 7a58c24582

View File

@@ -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 != "")
{