diff options
author | Helmut Grohne <helmut@subdivi.de> | 2025-07-11 14:47:37 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2025-07-11 14:47:37 +0200 |
commit | c97c6de178e727efdad42f08f6354d958fdb6b0d (patch) | |
tree | 8cb307b0290b5cf5c50ce1dbb56800e22dc127dc /examples/unschroot_fs.py | |
parent | 58dca9beea23e4e18c67f6f13838f5a895ca150f (diff) | |
download | python-linuxnamespaces-c97c6de178e727efdad42f08f6354d958fdb6b0d.tar.gz |
prefer getpass.getuser() over os.getlogin()
os.getlogin() returns an undesired value in a runuser environment and is
not overridable with environment.
Diffstat (limited to 'examples/unschroot_fs.py')
-rwxr-xr-x | examples/unschroot_fs.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/unschroot_fs.py b/examples/unschroot_fs.py index 68e2320..a07f32d 100755 --- a/examples/unschroot_fs.py +++ b/examples/unschroot_fs.py @@ -18,6 +18,7 @@ between calls with no background processes or persistent namespaces. import argparse import grp +import getpass import os import pathlib import pwd @@ -474,7 +475,9 @@ def main() -> None: parser.add_argument("-d", "--directory", action="store") parser.add_argument("-p", "--preserve-environment", action="store_true") parser.add_argument("-q", "--quiet", action="store_true") - parser.add_argument("-u", "--user", action="store", default=os.getlogin()) + parser.add_argument( + "-u", "--user", action="store", default=getpass.getuser() + ) parser.add_argument("--isolate-network", action="store_true") parser.add_argument("command", nargs="*") args = parser.parse_args() |