Skip to content

Commit 72e9de0

Browse files
committed
a couple more checks on shell output to see if this can shed light on issue #17
1 parent a17c8b2 commit 72e9de0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tetherback/tetherback.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,12 @@ def really_umount(dev, node):
120120
break
121121
for l in sp.check_output(adbcmd+('shell','mount')).splitlines():
122122
f = l.decode().split()
123-
mdev, mnode = (f[0], f[2]) if (f[1], f[3])==('on','type') else (f[0], f[1])
124-
if mdev==dev or mnode==node:
125-
return False
123+
if len(f)<4:
124+
print( "WARNING: don't understand output from mount: %s" % (repr(l)), file=stderr )
125+
else:
126+
mdev, mnode = (f[0], f[2]) if (f[1], f[3])==('on','type') else (f[0], f[1])
127+
if mdev==dev or mnode==node:
128+
return False
126129
return True
127130

128131
def really_forward(port1, port2):
@@ -141,7 +144,9 @@ def uevent_dict(path):
141144
lines = sp.check_output(adbcmd+('shell','cat "%s"'%path)).decode().splitlines()
142145
d = {}
143146
for l in lines:
144-
if '=' not in l:
147+
if not l:
148+
pass
149+
elif '=' not in l:
145150
print( "WARNING: don't understand this line from %s: %s" % (repr(path), repr(l)), file=stderr )
146151
else:
147152
k, v = l.split('=',1)

0 commit comments

Comments
 (0)