diff --git a/dist/tools/usb-serial/ttys.py b/dist/tools/usb-serial/ttys.py index 13bf872416..dd1bc4883e 100755 --- a/dist/tools/usb-serial/ttys.py +++ b/dist/tools/usb-serial/ttys.py @@ -176,7 +176,7 @@ def generate_filters(args): Generate filters for use in the filters_match function from the command line arguments """ - result = list() + result = [] if args.serial is not None: result.append(("serial", re.compile(r"^" + re.escape(args.serial) + r"$"))) @@ -225,6 +225,9 @@ def print_ttys(args): else: ttys = [] + if len(ttys) == 0: + sys.exit(1) + print_results(args, ttys)