chiark / gitweb /
Avoid strange outcomes of "adb devices"
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 26 Dec 2013 18:18:36 +0000 (19:18 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 9 Jan 2014 15:23:47 +0000 (16:23 +0100)
fdroidserver/install.py

index b61cfcb447de49bf0331aa562c5a69f275e0fbfe..0f444cff49aa2a57f0c0bb8cbdf4f12f83aaa691 100644 (file)
@@ -33,7 +33,11 @@ def devices():
     p = FDroidPopen(["adb", "devices"])
     if p.returncode != 0:
         raise Exception("An error occured when finding devices: %s" % p.stderr)
-    return [l.split()[0] for l in p.stdout.splitlines()[1:-1]]
+    lines = p.stdout.splitlines()
+    if len(lines) < 3:
+        return []
+    lines = lines[1:-1]
+    return [l.split()[0] for l in lines]
 
 
 def main():