From c5bbea8db364b88558acc434be16ec82c04737e5 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 16 Feb 2021 15:45:19 -0500 Subject: [PATCH] git_command: make execution synchronous Every use of GitCommand in the tree just calls Wait as soon as it's instantiated. Move the bulk of the logic into the init path to make the call synchronous to simplify. We'll cleanup the users of the Wait API to follup commits -- having this split makes it easier to track down regressions. Change-Id: I1e8c519efa912da723749ff7663558c04c1f491c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297244 Reviewed-by: Jonathan Nieder Tested-by: Mike Frysinger --- git_command.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/git_command.py b/git_command.py index 6e285224..6cb6e0c3 100644 --- a/git_command.py +++ b/git_command.py @@ -352,6 +352,11 @@ class GitCommand(object): p.stdin.write(input) p.stdin.close() + try: + self.rc = self._CaptureOutput() + finally: + _remove_ssh_client(p) + @staticmethod def _GetBasicEnv(): """Return a basic env for running git under. @@ -370,12 +375,7 @@ class GitCommand(object): return env def Wait(self): - try: - p = self.process - rc = self._CaptureOutput() - finally: - _remove_ssh_client(p) - return rc + return self.rc def _CaptureOutput(self): p = self.process