Skip to content

Commit

Permalink
Pass filename instead of piping contents through stdin to dart format in
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bkonyi authored and commit-bot@chromium.org committed Jul 13, 2021
1 parent 723df3d commit 44ffad5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,13 @@ def HasFormatErrors(filename=None, contents=None):
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
Expand Down

0 comments on commit 44ffad5

Please sign in to comment.