summaryrefslogtreecommitdiff
path: root/tools/format.py
diff options
context:
space:
mode:
authorMark Tiedemann <www.marktiedemann@gmail.com>2020-06-06 13:20:29 +0200
committerGitHub <noreply@github.com>2020-06-06 13:20:29 +0200
commit2093ee55d4c728448a3db373dd416b6eea845c14 (patch)
tree38857711aca11a4f943b4ce6c6563271b2b6512c /tools/format.py
parentee192b075819ccc3a6e3dfbf0eab36fd090fced4 (diff)
Chunk prettier invocation (#6129)
This avoids failures due to exceeding the maximum command line length. Fixes: #5017
Diffstat (limited to 'tools/format.py')
-rwxr-xr-xtools/format.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/format.py b/tools/format.py
index ffeaa250d..f81d99164 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -58,11 +58,14 @@ def prettier():
"bin-prettier.js")
source_files = get_sources(root_path, ["*.js", "*.json", "*.ts", "*.md"])
if source_files:
- print_command("prettier", source_files)
- run(["node", script, "--write", "--loglevel=error", "--"] +
- source_files,
- shell=False,
- quiet=True)
+ max_command_length = 24000
+ while len(source_files) > 0:
+ command = ["node", script, "--write", "--loglevel=error", "--"]
+ while len(source_files) > 0:
+ command.append(source_files.pop())
+ if len(" ".join(command)) > max_command_length:
+ run(command, shell=False, quiet=True)
+ break
def yapf():