Checks that the permissions of a file are properly user-specific, if sudo is used.
(file: Union[pathlib.Path, str])
| 110 | |
| 111 | |
| 112 | def _check_perms(file: Union[pathlib.Path, str]) -> None: |
| 113 | """ |
| 114 | Checks that the permissions of a file are properly user-specific, if sudo is used. |
| 115 | """ |
| 116 | if ( |
| 117 | not WINDOWS and |
| 118 | "SUDO_UID" in os.environ and |
| 119 | "SUDO_GID" in os.environ |
| 120 | ): |
| 121 | # Was started with sudo. Still, chown to the user. |
| 122 | try: |
| 123 | os.chown( |
| 124 | file, |
| 125 | int(os.environ["SUDO_UID"]), |
| 126 | int(os.environ["SUDO_GID"]), |
| 127 | ) |
| 128 | except Exception: |
| 129 | pass |
| 130 | |
| 131 | |
| 132 | def _read_config_file(cf, _globals=globals(), _locals=locals(), |
no outgoing calls
no test coverage detected
searching dependent graphs…