summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Scott <barry@barrys-emacs.org>2016-07-29 14:04:27 +0100
committerBarry Scott <barry@barrys-emacs.org>2016-07-29 14:04:27 +0100
commit0d9390866f9ce42870d3116094cd49e0019a970a (patch)
tree480962677153157063a7cb3a9bf0f4bca6128d5a
parent1116ef7e1bcbbc71d0b654b63156b29bfbf9afab (diff)
downloadgitpython-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.
-rw-r--r--git/cmd.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/git/cmd.py b/git/cmd.py
index d8469565..a7f4285a 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -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: