From 0403a2cca59ed24c0a71486e29d701220e8c4cf7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 17:53:49 -0500 Subject: codeformat: Run sed only on requested files When running from pre-commit, we believe the different invocations of sed were racing with each other, sometimes leaving zero-byte files in the filesystem (ow) --- tools/codeformat.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'tools/codeformat.py') diff --git a/tools/codeformat.py b/tools/codeformat.py index fb2a94e49..e9615ae56 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -167,10 +167,7 @@ def main(): for file in lang_files(C_EXTS): fixup_c(file) # Revert "// |" back to "//|" - subprocess.call( - "find shared-bindings ports/*/bindings -name '*.c' -exec sed -i 's/\/ |/\/|/' {} \;", - shell=True, - ) + batch(["sed", "-i", "s,^// |,//|,"], lang_files(C_EXTS)) # Format Python files with black. if format_py: -- cgit v1.2.3