Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0d93908

Browse filesBrowse files
committed
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.
1 parent 1116ef7 commit 0d93908
Copy full SHA for 0d93908

File tree

1 file changed

+14
-1
lines changed
Filter options

1 file changed

+14
-1
lines changed

‎git/cmd.py

Copy file name to clipboardExpand all lines: git/cmd.py
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,12 @@ def execute(self, command,
609609
# end handle
610610

611611
try:
612+
if sys.platform == 'win32':
613+
CREATE_NO_WINDOW = 0x08000000
614+
creationflags = CREATE_NO_WINDOW
615+
else:
616+
creationflags = None
617+
612618
proc = Popen(command,
613619
env=env,
614620
cwd=cwd,
@@ -619,6 +625,7 @@ def execute(self, command,
619625
shell=self.USE_SHELL,
620626
close_fds=(os.name == 'posix'), # unsupported on windows
621627
universal_newlines=universal_newlines,
628+
creationflags=creationflags,
622629
**subprocess_kwargs
623630
)
624631
except cmd_not_found_exception as err:
@@ -629,7 +636,13 @@ def execute(self, command,
629636

630637
def _kill_process(pid):
631638
""" Callback method to kill a process. """
632-
p = Popen(['ps', '--ppid', str(pid)], stdout=PIPE)
639+
if sys.platform == 'win32':
640+
CREATE_NO_WINDOW = 0x08000000
641+
creationflags = CREATE_NO_WINDOW
642+
else:
643+
creationflags = None
644+
645+
p = Popen(['ps', '--ppid', str(pid)], stdout=PIPE, creationflags)
633646
child_pids = []
634647
for line in p.stdout:
635648
if len(line.split()) > 0:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.