Skip to content

Commit

Permalink
fix(run_clang_format.py): Add early return for empty `formatted_filen…
Browse files Browse the repository at this point in the history
…ames` in check function.

If `formatted_filenames` is empty, it will run `clang-format` with the `-i` flag on an empty list, resulting `error: cannot use -i when reading from stdin`
  • Loading branch information
hao0012 committed Dec 25, 2024
1 parent 5705473 commit 5190efb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build_support/run_clang_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def check(arguments, source_dir):
[filename for filename in source_files
if not any((fnmatch.fnmatch(filename, exclude_glob)
for exclude_glob in exclude_globs))])
if len(formatted_filenames) == 0:
return

if arguments.fix:
if not arguments.quiet:
Expand Down

0 comments on commit 5190efb

Please sign in to comment.