diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2016-08-02 05:46:45 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2016-08-02 05:46:45 +0200 |
commit | df958981ad63edae6fceb69650c1fb9890c2b14f (patch) | |
tree | 4ded3dd300a5a6d02ce3c354af09dcf516b86bec /git/cmd.py | |
parent | d8ef023a5bab377764343c954bf453869def4807 (diff) | |
download | gitpython-df958981ad63edae6fceb69650c1fb9890c2b14f.tar.gz |
refactor(cmd): streamline usage of creationflags
Diffstat (limited to 'git/cmd.py')
-rw-r--r-- | git/cmd.py | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -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: |