43
43
safe_decode ,
44
44
)
45
45
46
- # value of Windows process creation flag taken from MSDN
47
- CREATE_NO_WINDOW = 0x08000000
48
-
49
46
execute_kwargs = ('istream' , 'with_keep_cwd' , 'with_extended_output' ,
50
47
'with_exceptions' , 'as_process' , 'stdout_as_string' ,
51
48
'output_stream' , 'with_stdout' , 'kill_after_timeout' ,
@@ -249,6 +246,9 @@ class Git(LazyMixin):
249
246
# Enables debugging of GitPython's git commands
250
247
GIT_PYTHON_TRACE = os .environ .get ("GIT_PYTHON_TRACE" , False )
251
248
249
+ # value of Windows process creation flag taken from MSDN
250
+ CREATE_NO_WINDOW = 0x08000000
251
+
252
252
# Provide the full path to the git executable. Otherwise it assumes git is in the path
253
253
_git_exec_env_var = "GIT_PYTHON_GIT_EXECUTABLE"
254
254
GIT_PYTHON_GIT_EXECUTABLE = os .environ .get (_git_exec_env_var , git_exec_name )
@@ -611,12 +611,8 @@ def execute(self, command,
611
611
cmd_not_found_exception = OSError
612
612
# end handle
613
613
614
+ creationflags = self .CREATE_NO_WINDOW if sys .platform == 'win32' else 0
614
615
try :
615
- if sys .platform == 'win32' :
616
- creationflags = CREATE_NO_WINDOW
617
- else :
618
- creationflags = 0
619
-
620
616
proc = Popen (command ,
621
617
env = env ,
622
618
cwd = cwd ,
@@ -638,11 +634,6 @@ def execute(self, command,
638
634
639
635
def _kill_process (pid ):
640
636
""" Callback method to kill a process. """
641
- if sys .platform == 'win32' :
642
- creationflags = CREATE_NO_WINDOW
643
- else :
644
- creationflags = 0
645
-
646
637
p = Popen (['ps' , '--ppid' , str (pid )], stdout = PIPE , creationflags = creationflags )
647
638
child_pids = []
648
639
for line in p .stdout :
0 commit comments