[PATCH 4 of 4 hglib] util, popen: hide subprocess window

Idan Kamara idankk86 at gmail.com
Mon Sep 26 14:41:01 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1317065866 -10800
# Node ID a5dd7b5d0be11a52a5207f421db6e90751fe548e
# Parent  77ae99e032f61263ba10d84c4725f2b3e06a289f
util, popen: hide subprocess window

so a console doesn't open up on Windows

diff --git a/hglib/util.py b/hglib/util.py
--- a/hglib/util.py
+++ b/hglib/util.py
@@ -133,6 +133,11 @@
 
 close_fds = os.name == 'posix'
 
+startupinfo = None
+if os.name == 'nt':
+    startupinfo = subprocess.STARTUPINFO()
+    startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+
 def popen(args, env={}):
     environ = None
     if env:
@@ -141,4 +146,4 @@
 
     return subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE, close_fds=close_fds,
-                            env=environ)
+                            startupinfo=startupinfo, env=environ)


More information about the Mercurial-devel mailing list