@@ -246,6 +246,9 @@ class Git(LazyMixin):
246246 # Enables debugging of GitPython's git commands
247247 GIT_PYTHON_TRACE = os .environ .get ("GIT_PYTHON_TRACE" , False )
248248
249+ # value of Windows process creation flag taken from MSDN
250+ CREATE_NO_WINDOW = 0x08000000
251+
249252 # Provide the full path to the git executable. Otherwise it assumes git is in the path
250253 _git_exec_env_var = "GIT_PYTHON_GIT_EXECUTABLE"
251254 GIT_PYTHON_GIT_EXECUTABLE = os .environ .get (_git_exec_env_var , git_exec_name )
@@ -608,6 +611,7 @@ def execute(self, command,
608611 cmd_not_found_exception = OSError
609612 # end handle
610613
614+ creationflags = self .CREATE_NO_WINDOW if sys .platform == 'win32' else 0
611615 try :
612616 proc = Popen (command ,
613617 env = env ,
@@ -619,6 +623,7 @@ def execute(self, command,
619623 shell = self .USE_SHELL ,
620624 close_fds = (os .name == 'posix' ), # unsupported on windows
621625 universal_newlines = universal_newlines ,
626+ creationflags = creationflags ,
622627 ** subprocess_kwargs
623628 )
624629 except cmd_not_found_exception as err :
@@ -629,7 +634,7 @@ def execute(self, command,
629634
630635 def _kill_process (pid ):
631636 """ Callback method to kill a process. """
632- p = Popen (['ps' , '--ppid' , str (pid )], stdout = PIPE )
637+ p = Popen (['ps' , '--ppid' , str (pid )], stdout = PIPE , creationflags = creationflags )
633638 child_pids = []
634639 for line in p .stdout :
635640 if len (line .split ()) > 0 :
0 commit comments