diff hglib/client.py @ 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
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):