comparison hglib/client.py @ 200:7da1dad166b5

client: ignore close() on non-open clients (issue5751) Closing a client twice currently triggers a rather confusing exception. Instead, follow the convention set by Python's file objects, and ignore close() commands on non-open clients.
author Gábor Stefanik <gabor.stefanik@nng.com>
date Mon, 12 Feb 2018 14:54:09 +0100
parents 6949fc164439
children 67398bbf788d
comparison
equal deleted inserted replaced
199:1085c904d8c0 200:7da1dad166b5
289 returns the exit code. 289 returns the exit code.
290 290
291 Attempting to call any function afterwards that needs to 291 Attempting to call any function afterwards that needs to
292 communicate with the server will raise a ValueError. 292 communicate with the server will raise a ValueError.
293 """ 293 """
294 if not self.server:
295 return 0
294 return self._close()[0] 296 return self._close()[0]
295 297
296 def _close(self): 298 def _close(self):
297 _sout, serr = self.server.communicate() 299 _sout, serr = self.server.communicate()
298 ret = self.server.returncode 300 ret = self.server.returncode