tools/mpremote: Handle FileNotFound exceptions in listdir.

The except handler for OSError didn't include the line that actually calls
os.listdir, so an invalid path wasn't handled correctly.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared 2022-10-26 22:03:46 +11:00 committed by Damien George
parent 7775523b2d
commit 3427e12e8f

View File

@ -428,12 +428,11 @@ class PyboardCommand:
path = self.root + self.rd_str()
try:
self.path_check(path)
self.data_ilistdir[0] = path
self.data_ilistdir[1] = os.listdir(path)
self.wr_s8(0)
except OSError as er:
self.wr_s8(-abs(er.errno))
else:
self.data_ilistdir[0] = path
self.data_ilistdir[1] = os.listdir(path)
def do_ilistdir_next(self):
if self.data_ilistdir[1]: