[PATCH] D70518: [clang-include-fixer] Suppress cmd prompt from Vim on Windows

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 20 16:43:46 PST 2019


rnk created this revision.
rnk added reviewers: bkramer, sammccall.
Herald added a project: clang.

Copied from the clang-format.py editor integration.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70518

Files:
  clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py


Index: clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py
===================================================================
--- clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py
+++ clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py
@@ -85,9 +85,16 @@
 
 
 def execute(command, text):
+  # Avoid flashing a cmd prompt on Windows.
+  startupinfo = None
+  if sys.platform.startswith('win32'):
+    startupinfo = subprocess.STARTUPINFO()
+    startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+    startupinfo.wShowWindow = subprocess.SW_HIDE
+
   p = subprocess.Popen(command,
                        stdout=subprocess.PIPE, stderr=subprocess.PIPE,
-                       stdin=subprocess.PIPE)
+                       stdin=subprocess.PIPE, startupinfo=startupinfo)
   return p.communicate(input=text)
 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70518.230351.patch
Type: text/x-patch
Size: 860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191121/ff423039/attachment.bin>


More information about the cfe-commits mailing list