From 20c22ac562b362e31ea2d49fb58e3320d3424cb9 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Mon, 17 Jun 2024 16:42:44 +0200 Subject: [PATCH] fix(uncurl): add close-handler to uncurl This commit adds a close-handler to the uncurl annex remote. The handler closes all open `url_operations-instances`. This terminates all `shell`-related threads and allows the uncurl-process to exit. --- datalad_next/annexremotes/uncurl.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/datalad_next/annexremotes/uncurl.py b/datalad_next/annexremotes/uncurl.py index 0a9743c7..2e9af454 100644 --- a/datalad_next/annexremotes/uncurl.py +++ b/datalad_next/annexremotes/uncurl.py @@ -64,14 +64,14 @@ $ git annex addurl http://httpbin.org/basic-auth/myuser/mypassword Credential needed for access to http://httpbin.org/basic-auth/myuser/mypassword user: myuser - password: - password (repeat): + password: + password (repeat): Enter a name to save the credential (for accessing http://httpbin.org/basic-auth/myuser/mypassword) securely for future reuse, or 'skip' to not save the credential name: httpbin-dummy - addurl http://httpbin.org/basic-auth/myuser/mypassword (from uncurl) (to ...) + addurl http://httpbin.org/basic-auth/myuser/mypassword (from uncurl) (to ...) ok (recording state in git...) @@ -258,6 +258,14 @@ def __init__(self, annex: Master): # or across annex keys self.persistent_tmpl_props: dict[str, str] = {} + def __del__(self): + self.close() + + def close(self) -> None: + if self.url_handler: + del self.url_handler + self.url_handler = None + def initremote(self) -> None: # at present there is nothing that needs to be done on init/enable. # the remote is designed to work without any specific setup too