Hi djasper,

http://llvm-reviews.chandlerc.com/D941

Files:
  tools/clang-format/clang-format.py

Index: tools/clang-format/clang-format.py
===================================================================
--- tools/clang-format/clang-format.py
+++ tools/clang-format/clang-format.py
@@ -39,11 +39,18 @@
 length = int(vim.eval('line2byte(' +
                       str(vim.current.range.end + 2) + ')')) - offset - 2
 
+# Avoid flashing an ugly, ugly cmd prompt on Windows when invoking 
clang-format.
+startupinfo = None
+if sys.platform.startswith('win32'):
+  startupinfo = subprocess.STARTUPINFO()
+  startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+  startupinfo.wShowWindow = subprocess.SW_HIDE
+
 # Call formatter.
 p = subprocess.Popen([binary, '-offset', str(offset), '-length', str(length),
                       '-style', style, '-cursor', str(cursor)],
                      stdout=subprocess.PIPE, stderr=subprocess.PIPE,
-                     stdin=subprocess.PIPE)
+                     stdin=subprocess.PIPE, startupinfo=startupinfo)
 stdout, stderr = p.communicate(input=text)
 
 # If successful, replace buffer contents.
Index: tools/clang-format/clang-format.py
===================================================================
--- tools/clang-format/clang-format.py
+++ tools/clang-format/clang-format.py
@@ -39,11 +39,18 @@
 length = int(vim.eval('line2byte(' +
                       str(vim.current.range.end + 2) + ')')) - offset - 2
 
+# Avoid flashing an ugly, ugly cmd prompt on Windows when invoking clang-format.
+startupinfo = None
+if sys.platform.startswith('win32'):
+  startupinfo = subprocess.STARTUPINFO()
+  startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+  startupinfo.wShowWindow = subprocess.SW_HIDE
+
 # Call formatter.
 p = subprocess.Popen([binary, '-offset', str(offset), '-length', str(length),
                       '-style', style, '-cursor', str(cursor)],
                      stdout=subprocess.PIPE, stderr=subprocess.PIPE,
-                     stdin=subprocess.PIPE)
+                     stdin=subprocess.PIPE, startupinfo=startupinfo)
 stdout, stderr = p.communicate(input=text)
 
 # If successful, replace buffer contents.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to