summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format/clang-format-diff.py
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2013-12-05 08:14:54 +0000
committerAlp Toker <alp@nuanti.com>2013-12-05 08:14:54 +0000
commitfcf30326fd5f3815b2e6e2b1716f4c8be3c7ebb6 (patch)
tree90d32557bfdbd772a598b349d707adfbd370a22e /clang/tools/clang-format/clang-format-diff.py
parent34efb6aee1337f7aa65b9d443b720f499b19b415 (diff)
downloadbcm5719-llvm-fcf30326fd5f3815b2e6e2b1716f4c8be3c7ebb6.tar.gz
bcm5719-llvm-fcf30326fd5f3815b2e6e2b1716f4c8be3c7ebb6.zip
clang-format-diff.py: pass through errors to stderr, not stdout
Also use write() for unified diff output to avoid further processing by the print function (e.g. trailing newline). llvm-svn: 196484
Diffstat (limited to 'clang/tools/clang-format/clang-format-diff.py')
-rwxr-xr-xclang/tools/clang-format/clang-format-diff.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
index b042d957af0..a62cae8ad51 100755
--- a/clang/tools/clang-format/clang-format-diff.py
+++ b/clang/tools/clang-format/clang-format-diff.py
@@ -85,11 +85,8 @@ def main():
if args.style:
command.extend(['-style', args.style])
p = subprocess.Popen(command, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- stdin=subprocess.PIPE)
+ stderr=None, stdin=subprocess.PIPE)
stdout, stderr = p.communicate()
- if stderr:
- print stderr
if p.returncode != 0:
sys.exit(p.returncode);
@@ -102,7 +99,7 @@ def main():
'(before formatting)', '(after formatting)')
diff_string = string.join(diff, '')
if len(diff_string) > 0:
- print diff_string
+ sys.stdout.write(diff_string)
if __name__ == '__main__':
main()
OpenPOWER on IntegriCloud