summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrik Sjölin <ulrik.sjolin@sonyericsson.com>2011-09-11 22:59:37 +0200
committerShawn O. Pearce <sop@google.com>2011-11-29 11:54:58 -0800
commit498fe90b455e896e306498abd24961fd90a21c67 (patch)
tree1f45eba29d25a4751ebd43b6cfe89cf532e492d9
parent53d6f4d17e0cb4eabcd604d584a1132a51cc8bf3 (diff)
downloadgit-repo-498fe90b455e896e306498abd24961fd90a21c67.tar.gz
Stabilize repo communication with subprocesses.
Make repo use the standard way in python to work with pipes. Communication via pipes to sub processes is done by calling communicate(). This will make repo not hang every now and then. Change-Id: Ibe2c4ecbdbcbe72f0b725ca50d54088e5646fc5d
-rw-r--r--git_command.py22
1 files changed, 3 insertions, 19 deletions
diff --git a/git_command.py b/git_command.py
index d1e0c971..aecda0e4 100644
--- a/git_command.py
+++ b/git_command.py
@@ -221,26 +221,10 @@ class GitCommand(object):
221 self.stdin = p.stdin 221 self.stdin = p.stdin
222 222
223 def Wait(self): 223 def Wait(self):
224 p = self.process
225
226 if p.stdin:
227 p.stdin.close()
228 self.stdin = None
229
230 if p.stdout:
231 self.stdout = p.stdout.read()
232 p.stdout.close()
233 else:
234 p.stdout = None
235
236 if p.stderr:
237 self.stderr = p.stderr.read()
238 p.stderr.close()
239 else:
240 p.stderr = None
241
242 try: 224 try:
243 rc = p.wait() 225 p = self.process
226 (self.stdout, self.stderr) = p.communicate()
227 rc = p.returncode
244 finally: 228 finally:
245 _remove_ssh_client(p) 229 _remove_ssh_client(p)
246 return rc 230 return rc