4343 safe_decode ,
4444)
4545
46- # value of Windows process creation flag taken from MSDN
47- CREATE_NO_WINDOW = 0x08000000
48-
4946execute_kwargs = ('istream' , 'with_keep_cwd' , 'with_extended_output' ,
5047 'with_exceptions' , 'as_process' , 'stdout_as_string' ,
5148 'output_stream' , 'with_stdout' , 'kill_after_timeout' ,
@@ -249,6 +246,9 @@ class Git(LazyMixin):
249246 # Enables debugging of GitPython's git commands
250247 GIT_PYTHON_TRACE = os .environ .get ("GIT_PYTHON_TRACE" , False )
251248
249+ # value of Windows process creation flag taken from MSDN
250+ CREATE_NO_WINDOW = 0x08000000
251+
252252 # Provide the full path to the git executable. Otherwise it assumes git is in the path
253253 _git_exec_env_var = "GIT_PYTHON_GIT_EXECUTABLE"
254254 GIT_PYTHON_GIT_EXECUTABLE = os .environ .get (_git_exec_env_var , git_exec_name )
@@ -611,12 +611,8 @@ def execute(self, command,
611611 cmd_not_found_exception = OSError
612612 # end handle
613613
614+ creationflags = self .CREATE_NO_WINDOW if sys .platform == 'win32' else 0
614615 try :
615- if sys .platform == 'win32' :
616- creationflags = CREATE_NO_WINDOW
617- else :
618- creationflags = 0
619-
620616 proc = Popen (command ,
621617 env = env ,
622618 cwd = cwd ,
@@ -638,11 +634,6 @@ def execute(self, command,
638634
639635 def _kill_process (pid ):
640636 """ Callback method to kill a process. """
641- if sys .platform == 'win32' :
642- creationflags = CREATE_NO_WINDOW
643- else :
644- creationflags = 0
645-
646637 p = Popen (['ps' , '--ppid' , str (pid )], stdout = PIPE , creationflags = creationflags )
647638 child_pids = []
648639 for line in p .stdout :
0 commit comments