diff options
author | Jürg Billeter <j@bitron.ch> | 2019-11-18 11:26:47 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-11-25 09:45:22 +0100 |
commit | f439c47deb6ea79e0b17b8e0429d0b834ce15e05 (patch) | |
tree | 80d039a1705d6a2cf7f18fab1a76d20c6e581839 /src | |
parent | c6e2ea93a0bf8dcc34623339063e6a91b2eb3d51 (diff) | |
download | buildstream-f439c47deb6ea79e0b17b8e0429d0b834ce15e05.tar.gz |
utils.py: Add get_umask() method
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/utils.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/buildstream/utils.py b/src/buildstream/utils.py index 181ea1df9..5bc1ce08f 100644 --- a/src/buildstream/utils.py +++ b/src/buildstream/utils.py @@ -65,6 +65,11 @@ _INITIAL_NUM_THREADS_IN_MAIN_PROCESS = 1 # Number of seconds to wait for background threads to exit. _AWAIT_THREADS_TIMEOUT_SECONDS = 5 +# The process's file mode creation mask. +# Impossible to retrieve without temporarily changing it on POSIX. +_UMASK = os.umask(0o777) +os.umask(_UMASK) + class UtilError(BstError): """Raised by utility functions when system calls fail. @@ -638,6 +643,17 @@ def save_file_atomic( raise +# get_umask(): +# +# Get the process's file mode creation mask without changing it. +# +# Returns: +# (int) The process's file mode creation mask. +# +def get_umask(): + return _UMASK + + # _get_dir_size(): # # Get the disk usage of a given directory in bytes. |