# HG changeset patch # User Augie Fackler # Date 1512928257 18000 # Node ID c586d02f7cdad2615a094fffa160a305779cd32d # Parent 7c37f08d303d7657269a39feeacc08607e2949eb _readchannel: if a read failure is due to a broken server, report that We can end up in this codepath if the specified hg binary fails to start, and we're better off reporting that than the fact that we got no response. diff -r 7c37f08d303d -r c586d02f7cda hglib/client.py --- a/hglib/client.py Sun Dec 10 12:37:36 2017 -0500 +++ b/hglib/client.py Sun Dec 10 12:50:57 2017 -0500 @@ -147,7 +147,10 @@ def _readchannel(self): data = self.server.stdout.read(hgclient.outputfmtsize) if not data: - self.close() + ret, serr = self._close() + if ret != 0: + raise error.ServerError('server exited with status %d: %s' + % (ret, serr.strip())) raise error.ResponseError('no response received from server') channel, length = struct.unpack(hgclient.outputfmt, data) if channel in b('IL'): @@ -271,6 +274,10 @@ self.close() raise except error.ServerError: + if self.server is None: + # server is already closed, hopefully the ServerError + # we got has enough information. + raise ret, serr = self._close() raise error.ServerError('server exited with status %d: %s' % (ret, serr.strip()))