mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-23 07:16:21 +00:00
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>
This commit is contained in:
parent
5d9c4972e0
commit
c5bbea8db3
@ -352,6 +352,11 @@ class GitCommand(object):
|
|||||||
p.stdin.write(input)
|
p.stdin.write(input)
|
||||||
p.stdin.close()
|
p.stdin.close()
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.rc = self._CaptureOutput()
|
||||||
|
finally:
|
||||||
|
_remove_ssh_client(p)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _GetBasicEnv():
|
def _GetBasicEnv():
|
||||||
"""Return a basic env for running git under.
|
"""Return a basic env for running git under.
|
||||||
@ -370,12 +375,7 @@ class GitCommand(object):
|
|||||||
return env
|
return env
|
||||||
|
|
||||||
def Wait(self):
|
def Wait(self):
|
||||||
try:
|
return self.rc
|
||||||
p = self.process
|
|
||||||
rc = self._CaptureOutput()
|
|
||||||
finally:
|
|
||||||
_remove_ssh_client(p)
|
|
||||||
return rc
|
|
||||||
|
|
||||||
def _CaptureOutput(self):
|
def _CaptureOutput(self):
|
||||||
p = self.process
|
p = self.process
|
||||||
|
Loading…
Reference in New Issue
Block a user