mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:32:45 +01:00
dist/tools/usb-serial/ttys.py: improve error handling
Do not throw an exception when called with `--most-recent` but no matching serial was found.
This commit is contained in:
parent
0a872aaba2
commit
dc6e8e51d7
13
dist/tools/usb-serial/ttys.py
vendored
13
dist/tools/usb-serial/ttys.py
vendored
@ -213,11 +213,14 @@ def print_ttys(args):
|
||||
ttys.append(tty)
|
||||
|
||||
if args.most_recent:
|
||||
most_recent = ttys[0]
|
||||
for tty in ttys:
|
||||
if tty["ctime"] > most_recent["ctime"]:
|
||||
most_recent = tty
|
||||
ttys = [most_recent]
|
||||
if len(ttys) > 0:
|
||||
most_recent = ttys[0]
|
||||
for tty in ttys:
|
||||
if tty["ctime"] > most_recent["ctime"]:
|
||||
most_recent = tty
|
||||
ttys = [most_recent]
|
||||
else:
|
||||
ttys = []
|
||||
|
||||
print_results(args, ttys)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user