summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2016-08-02 05:46:45 +0200
committerSebastian Thiel <byronimo@gmail.com>2016-08-02 05:46:45 +0200
commitdf958981ad63edae6fceb69650c1fb9890c2b14f (patch)
tree4ded3dd300a5a6d02ce3c354af09dcf516b86bec /git/cmd.py
parentd8ef023a5bab377764343c954bf453869def4807 (diff)
downloadgitpython-df958981ad63edae6fceb69650c1fb9890c2b14f.tar.gz
refactor(cmd): streamline usage of creationflags
Diffstat (limited to 'git/cmd.py')
-rw-r--r--git/cmd.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 00a73e33..62eef9e4 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -43,9 +43,6 @@ from git.compat import (
safe_decode,
)
-# value of Windows process creation flag taken from MSDN
-CREATE_NO_WINDOW = 0x08000000
-
execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output',
'with_exceptions', 'as_process', 'stdout_as_string',
'output_stream', 'with_stdout', 'kill_after_timeout',
@@ -249,6 +246,9 @@ class Git(LazyMixin):
# Enables debugging of GitPython's git commands
GIT_PYTHON_TRACE = os.environ.get("GIT_PYTHON_TRACE", False)
+ # value of Windows process creation flag taken from MSDN
+ CREATE_NO_WINDOW = 0x08000000
+
# Provide the full path to the git executable. Otherwise it assumes git is in the path
_git_exec_env_var = "GIT_PYTHON_GIT_EXECUTABLE"
GIT_PYTHON_GIT_EXECUTABLE = os.environ.get(_git_exec_env_var, git_exec_name)
@@ -611,12 +611,8 @@ class Git(LazyMixin):
cmd_not_found_exception = OSError
# end handle
+ creationflags = self.CREATE_NO_WINDOW if sys.platform == 'win32' else 0
try:
- if sys.platform == 'win32':
- creationflags = CREATE_NO_WINDOW
- else:
- creationflags = 0
-
proc = Popen(command,
env=env,
cwd=cwd,
@@ -638,11 +634,6 @@ class Git(LazyMixin):
def _kill_process(pid):
""" Callback method to kill a process. """
- if sys.platform == 'win32':
- creationflags = CREATE_NO_WINDOW
- else:
- creationflags = 0
-
p = Popen(['ps', '--ppid', str(pid)], stdout=PIPE, creationflags=creationflags)
child_pids = []
for line in p.stdout: