Add timeout to Android 'getDeviceSDKVersion' command, fix #313

This commit is contained in:
Joshua Granick
2015-01-10 09:07:22 -08:00
parent c45e1a4db0
commit e0db9d33a9

View File

@@ -82,10 +82,6 @@ class AndroidHelper {
public static function getDeviceSDKVersion (deviceID:String):Int {
// need to wake up ADB, this shouldn't be necessary :(
ProcessHelper.runCommand (adbPath, adbName, [ "kill-server" ]);
ProcessHelper.runCommand (adbPath, adbName, [ "start-server" ]);
var tempFile = PathHelper.getTemporaryFile ();
var args = [ "wait-for-device", "shell", "getprop", "ro.build.version.sdk", ">", tempFile ];
@@ -99,7 +95,15 @@ class AndroidHelper {
}
ProcessHelper.runCommand (adbPath, adbName, args);
if (PlatformHelper.hostPlatform == Platform.MAC) {
ProcessHelper.runCommand (adbPath, "perl", [ "-e", 'alarm shift @ARGV; exec @ARGV', "3", adbName ].concat (args));
} else {
ProcessHelper.runCommand (adbPath, adbName, args);
}
if (FileSystem.exists (tempFile)) {