From 697702e72c4b148e987b873e6094da081beeb7cf Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 15 Dec 2009 23:07:17 +0100 Subject: index: improved the way stdout is handled as the previous handling rarely caused lockups while waiting for stdout NOTE: This does not have the desired effect, the issue appears to be somewhere within git, possibly, as git simply does not terminate waiting for something, even if stdout is closed. --- lib/git/index.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/git/index.py') diff --git a/lib/git/index.py b/lib/git/index.py index 9748df9f..334e84aa 100644 --- a/lib/git/index.py +++ b/lib/git/index.py @@ -926,7 +926,7 @@ class IndexFile(LazyMixin, diff.Diffable): self._write_path_to_stdin(proc, filepath, filepath, make_exc, fprogress, read_from_stdout=False) added_files.append(filepath) # END for each filepath - self._flush_stdin_and_wait(proc) # ignore stdout + self._flush_stdin_and_wait(proc, ignore_stdout=True) # ignore stdout # force rereading our entries once it is all done del(self.entries) @@ -978,7 +978,7 @@ class IndexFile(LazyMixin, diff.Diffable): if not progress_sent: fprogress(entry.path, True, entry) # END for each enty - self._flush_stdin_and_wait(proc) + self._flush_stdin_and_wait(proc, ignore_stdout=True) entries_added.extend(entries) # END if there are base entries @@ -1059,10 +1059,13 @@ class IndexFile(LazyMixin, diff.Diffable): return Commit.create_from_tree(self.repo, tree_sha, message, parent_commits, head) @classmethod - def _flush_stdin_and_wait(cls, proc): + def _flush_stdin_and_wait(cls, proc, ignore_stdout = False): proc.stdin.flush() proc.stdin.close() - stdout = proc.stdout.read() + stdout = '' + if not ignore_stdout: + stdout = proc.stdout.read() + proc.stdout.close() proc.wait() return stdout @@ -1192,7 +1195,7 @@ class IndexFile(LazyMixin, diff.Diffable): checked_out_files.append(path) # END path is a file # END for each path - self._flush_stdin_and_wait(proc) + self._flush_stdin_and_wait(proc, ignore_stdout=True) handle_stderr(proc, checked_out_files) return checked_out_files -- cgit v1.2.1