Pass filename instead of piping contents through stdin to dart format in

PRESUBMIT.py

FIXES=#46600

Change-Id: I69358185b5a8dfc863f17cd4beb0209592d3be09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206681
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Ben Konyi
2021-07-13 18:36:57 +00:00
committed by commit-bot@chromium.org
parent 723df3d4a4
commit 44ffad59d2
+3 -7
View File
@@ -133,17 +133,13 @@ def _CheckDartFormat(input_api, output_api):
dart,
'format',
'--set-exit-if-changed',
'--output=none',
'--summary=none',
filename,
]
if not contents:
args += [
'--output=none',
'--summary=none',
filename,
]
process = subprocess.Popen(
args, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
process.communicate(input=contents)
# Check for exit code 1 explicitly to distinguish it from a syntax error
# in the file (exit code 65). The repo contains many Dart files that are