pw_watch: Remove recursive glob
This glob never terminates if there are path loops involving symlinks in
the project directory. It's also not very efficient.
Change-Id: I5dc6b941a201e1d41470eac10b0f42af064fd50f
diff --git a/pw_watch/py/pw_watch/watch.py b/pw_watch/py/pw_watch/watch.py
index 5674b0e..0687208 100755
--- a/pw_watch/py/pw_watch/watch.py
+++ b/pw_watch/py/pw_watch/watch.py
@@ -476,7 +476,11 @@
build_commands = []
if not build_commands_tmp:
_LOG.info('Searching for GN build dirs...')
- gn_args_files = glob.glob('**/args.gn', recursive=True)
+ gn_args_files = []
+ if os.path.isfile('out/args.gn'):
+ gn_args_files += ['out/args.gn']
+ gn_args_files += glob.glob('out/*/args.gn')
+
for gn_args_file in gn_args_files:
gn_build_dir = pathlib.Path(gn_args_file).parent
gn_build_dir = gn_build_dir.resolve().relative_to(cur_dir)