Mercurial > python-hglib
changeset 168:d71bd813c9d7
client: use subprocess.communicate() to shut down server process
This allows us to get stderr output with no deadlock risk. Also, it should
fix possible deadlock issue at server.wait().
https://docs.python.org/2.7/library/subprocess.html#subprocess.Popen.wait
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 07 Sep 2015 22:32:12 +0900 |
parents | f22f3ff3cfae |
children | e6589149b2c8 |
files | hglib/client.py |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hglib/client.py Mon Sep 07 22:26:59 2015 +0900 +++ b/hglib/client.py Mon Sep 07 22:32:12 2015 +0900 @@ -200,14 +200,13 @@ Attempting to call any function afterwards that needs to communicate with the server will raise a ValueError. """ - return self._close() + return self._close()[0] def _close(self): - self.server.stdin.close() - self.server.wait() + _sout, serr = self.server.communicate() ret = self.server.returncode self.server = None - return ret + return ret, serr def add(self, files=[], dryrun=False, subrepos=False, include=None, exclude=None):