diff options
author | Barry Scott <barry@barrys-emacs.org> | 2016-07-29 14:04:27 +0100 |
---|---|---|
committer | Barry Scott <barry@barrys-emacs.org> | 2016-07-29 14:04:27 +0100 |
commit | 0d9390866f9ce42870d3116094cd49e0019a970a (patch) | |
tree | 480962677153157063a7cb3a9bf0f4bca6128d5a /git/cmd.py | |
parent | 1116ef7e1bcbbc71d0b654b63156b29bfbf9afab (diff) | |
download | gitpython-0d9390866f9ce42870d3116094cd49e0019a970a.tar.gz |
Prevent CMD windows being shown when starting git in a subprocess.
This fixes a UI problem with using GitPython from a GUI python probgram.
Each repo that is opened creates a git cat-file processs and that provess will create
a console window with out this change.
Diffstat (limited to 'git/cmd.py')
-rw-r--r-- | git/cmd.py | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -609,6 +609,12 @@ class Git(LazyMixin): # end handle try: + if sys.platform == 'win32': + CREATE_NO_WINDOW = 0x08000000 + creationflags = CREATE_NO_WINDOW + else: + creationflags = None + proc = Popen(command, env=env, cwd=cwd, @@ -619,6 +625,7 @@ class Git(LazyMixin): shell=self.USE_SHELL, close_fds=(os.name == 'posix'), # unsupported on windows universal_newlines=universal_newlines, + creationflags=creationflags, **subprocess_kwargs ) except cmd_not_found_exception as err: @@ -629,7 +636,13 @@ class Git(LazyMixin): def _kill_process(pid): """ Callback method to kill a process. """ - p = Popen(['ps', '--ppid', str(pid)], stdout=PIPE) + if sys.platform == 'win32': + CREATE_NO_WINDOW = 0x08000000 + creationflags = CREATE_NO_WINDOW + else: + creationflags = None + + p = Popen(['ps', '--ppid', str(pid)], stdout=PIPE, creationflags) child_pids = [] for line in p.stdout: if len(line.split()) > 0: |