changeset 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 1085c904d8c0
children 67398bbf788d
files hglib/client.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hglib/client.py	Thu Feb 01 15:10:02 2018 -0500
+++ b/hglib/client.py	Mon Feb 12 14:54:09 2018 +0100
@@ -291,6 +291,8 @@
         Attempting to call any function afterwards that needs to
         communicate with the server will raise a ValueError.
         """
+        if not self.server:
+            return 0
         return self._close()[0]
 
     def _close(self):