Skip to content

Commit cc1e80a

Browse files
committed
make the mount parsing even more stupider — trying to sort out issue #17
1 parent 72e9de0 commit cc1e80a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tetherback/tetherback.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,14 @@ def really_mount(dev, node, mode='ro'):
108108
break
109109
for l in sp.check_output(adbcmd+('shell','mount')).splitlines():
110110
f = l.decode().split()
111-
mdev, mnode, mtype = (f[0], f[2], f[4]) if (f[1], f[3])==('on','type') else (f[0], f[1], f[2])
112-
if mdev==dev or mnode==node:
113-
return mtype
111+
if not l:
112+
pass
113+
elif len(f)<4:
114+
print( "WARNING: don't understand output from mount: %s" % (repr(l)), file=stderr )
115+
else:
116+
mdev, mnode, mtype = (f[0], f[2], f[4]) if (f[1], f[3])==('on','type') else (f[0], f[1], f[2])
117+
if mdev==dev or mnode==node:
118+
return mtype
114119

115120
def really_umount(dev, node):
116121
for opts in ('','-f','-l','-r'):
@@ -120,7 +125,9 @@ def really_umount(dev, node):
120125
break
121126
for l in sp.check_output(adbcmd+('shell','mount')).splitlines():
122127
f = l.decode().split()
123-
if len(f)<4:
128+
if not l:
129+
pass
130+
elif len(f)<4:
124131
print( "WARNING: don't understand output from mount: %s" % (repr(l)), file=stderr )
125132
else:
126133
mdev, mnode = (f[0], f[2]) if (f[1], f[3])==('on','type') else (f[0], f[1])

0 commit comments

Comments
 (0)