[PATCH] [clang-format] Don't flash an ugly cmd prompt in Vim on Windows
Reid Kleckner
rnk at google.com
Mon Jun 10 06:39:37 PDT 2013
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D941.1.patch
Type: text/x-patch
Size: 1050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130610/5d6b8279/attachment.bin>
More information about the cfe-commits
mailing list