fix installer killed process mask

This commit is contained in:
Samuel Onoja committed 2026-10-02 14:48:59 +01:00
1 parent 96f5ee442e
commit 3a79121308
2 files changed
+74 -1

No files matched your search

+7 -1
View File
@@ -60,7 +60,13 @@ def ensure_directory(path, mode=0o755):
cursor = cursor.parent
for directory in reversed(missing):
directory.mkdir(mode=mode)
# This CLI is single-threaded. Apply the requested mode at creation so
# a process killed before chmod cannot leave a umask-restricted parent.
previous_umask = os.umask(0)
try:
directory.mkdir(mode=mode)
finally:
os.umask(previous_umask)
directory.chmod(mode)
sync_dir(directory.parent)