From 03655c310dccd4f6d61af262ccf886b7e3906fe4 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Wed, 15 May 2024 13:09:05 -0700 Subject: build-release-notes: fail if the directory does not exist This was a combination of two problems: the python didn't throw an error because apparently glob on a nonexistent directory doesn't crash, and secondarily, bash ignores bad exit codes without `set -e` if they are not in the final/only command. Change-Id: I812bde7a4daee5c77ffe9d7c73a25fd14969f548 --- maintainers/build-release-notes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'maintainers/build-release-notes.py') diff --git a/maintainers/build-release-notes.py b/maintainers/build-release-notes.py index 85bc40aba..311dca803 100644 --- a/maintainers/build-release-notes.py +++ b/maintainers/build-release-notes.py @@ -40,7 +40,10 @@ def plural_list(strs: list[str]) -> str: return '{}{} and {}'.format(', '.join(strs[:-1]), comma, strs[-1]) def run_on_dir(d): - paths = pathlib.Path(d).glob('*.md') + d = pathlib.Path(d) + if not d.is_dir(): + raise ValueError(f'provided path {d} is not a directory') + paths = d.glob('*.md') entries = [] for p in paths: try: -- cgit v1.2.3