Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: make os_chmod best-effort, unless critical=True is specified #8997

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions electrum/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down