summaryrefslogtreecommitdiffstats
path: root/git_command.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-02-16 15:45:19 -0500
committerMike Frysinger <vapier@google.com>2021-02-20 08:41:10 +0000
commitc5bbea8db364b88558acc434be16ec82c04737e5 (patch)
tree1dafbd9f6959a6f036eab960a42f4b241eb7ea0e /git_command.py
parent5d9c4972e075afb55dca0f65095b2c7dfffdf389 (diff)
downloadgit-repo-c5bbea8db364b88558acc434be16ec82c04737e5.tar.gz
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 <jrn@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'git_command.py')
-rw-r--r--git_command.py12
1 files 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):
352 p.stdin.write(input) 352 p.stdin.write(input)
353 p.stdin.close() 353 p.stdin.close()
354 354
355 try:
356 self.rc = self._CaptureOutput()
357 finally:
358 _remove_ssh_client(p)
359
355 @staticmethod 360 @staticmethod
356 def _GetBasicEnv(): 361 def _GetBasicEnv():
357 """Return a basic env for running git under. 362 """Return a basic env for running git under.
@@ -370,12 +375,7 @@ class GitCommand(object):
370 return env 375 return env
371 376
372 def Wait(self): 377 def Wait(self):
373 try: 378 return self.rc
374 p = self.process
375 rc = self._CaptureOutput()
376 finally:
377 _remove_ssh_client(p)
378 return rc
379 379
380 def _CaptureOutput(self): 380 def _CaptureOutput(self):
381 p = self.process 381 p = self.process