FIx issue #464 corrupt log file by barry-scott · Pull Request #469 · gitpython-developers/GitPython
# 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',
try: if sys.platform == 'win32':
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally for these kinds of assignment, I believe it's easier to read by starting out like this:
creationflags = None if sys.platform == 'win32': creationflags = CREATE_NO_WINDOW
proc = Popen(command, env=env, cwd=cwd,
def _kill_process(pid): """ Callback method to kill a process. """ p = Popen(['ps', '--ppid', str(pid)], stdout=PIPE) 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: if len(line.split()) > 0: