ssh/remote: make sure we also cleanup clan-ssh in the error case

This commit is contained in:
Jörg Thalheim
2025-05-26 17:35:15 +02:00
parent 91406b2016
commit 5a560ff219

View File

@@ -107,7 +107,7 @@ class Remote:
"/var/folders/"
):
directory = "/tmp/"
temp_dir = TemporaryDirectory(prefix="clan-ssh", dir=directory)
with TemporaryDirectory(prefix="clan-ssh", dir=directory) as temp_dir:
yield Remote(
address=self.address,
user=self.user,
@@ -120,9 +120,9 @@ class Remote:
verbose_ssh=self.verbose_ssh,
ssh_options=self.ssh_options,
tor_socks=self.tor_socks,
_control_path_dir=Path(temp_dir.name),
_control_path_dir=Path(temp_dir),
_askpass_path=self._askpass_path,
)
temp_dir.cleanup()
def run(
self,