From 0ac5bfbc1f1c47b356c24d8596b60198fc953a1a Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 8 Apr 2024 14:20:46 +0200 Subject: [PATCH] util: make os_chmod best-effort, unless critical=True is specified --- electrum/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/electrum/util.py b/electrum/util.py index f2c6f5743345..db6d563f2131 100644 --- a/electrum/util.py +++ b/electrum/util.py @@ -1111,7 +1111,7 @@ def write_json_file(path, data): raise FileExportFailed(e) -def os_chmod(path, mode): +def os_chmod(path, mode, critical=False): """os.chmod aware of tmpfs""" try: os.chmod(path, mode) @@ -1120,7 +1120,9 @@ def os_chmod(path, mode): if xdg_runtime_dir and is_subpath(path, xdg_runtime_dir): _logger.info(f"Tried to chmod in tmpfs. Skipping... {e!r}") else: - raise + if critical: + raise + _logger.info(f"Best-effort chmod failed: {e!r}") def make_dir(path, allow_symlink=True):