]> granicus.if.org Git - clang/commitdiff
clang-format-diff.py: pass through errors to stderr, not stdout
authorAlp Toker <alp@nuanti.com>
Thu, 5 Dec 2013 08:14:54 +0000 (08:14 +0000)
committerAlp Toker <alp@nuanti.com>
Thu, 5 Dec 2013 08:14:54 +0000 (08:14 +0000)
Also use write() for unified diff output to avoid further processing by the
print function (e.g. trailing newline).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196484 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-format/clang-format-diff.py

index b042d957af02e7752b399d7500cc956616cef6de..a62cae8ad51b44a52ee33db41af739f765111419 100755 (executable)
@@ -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()