From 44ffad59d2a5d54d7b68bd81e2875fa6d3886f9b Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 13 Jul 2021 18:36:57 +0000 Subject: [PATCH] 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 Commit-Queue: Ben Konyi --- PRESUBMIT.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 66ade81635e..ec4e5d2f514 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -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