diff options
author | Barry Warsaw <barry@python.org> | 2018-01-24 17:51:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-24 17:51:29 (GMT) |
commit | d499031f5f33c3ef71be7c81ef52eee6b47c42e1 (patch) | |
tree | 7998708eb21596ed635b2427b862b9c226d279a9 /Doc/library/os.rst | |
parent | 22feeb88b473b288950cdb2f6c5d28692274b5f9 (diff) | |
download | cpython-d499031f5f33c3ef71be7c81ef52eee6b47c42e1.zip cpython-d499031f5f33c3ef71be7c81ef52eee6b47c42e1.tar.gz cpython-d499031f5f33c3ef71be7c81ef52eee6b47c42e1.tar.bz2 |
bpo-32651 Recommend getpass.getuser() (#5301)
* bpo-32651 - In the documentation for os.getlogin(), recommend getpass.getuser()
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r-- | Doc/library/os.rst | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst index ee08853..9cb34de 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -325,10 +325,11 @@ process and user. .. function:: getlogin() Return the name of the user logged in on the controlling terminal of the - process. For most purposes, it is more useful to use the environment - variables :envvar:`LOGNAME` or :envvar:`USERNAME` to find out who the user - is, or ``pwd.getpwuid(os.getuid())[0]`` to get the login name of the current - real user id. + process. For most purposes, it is more useful to use + :func:`getpass.getuser` since the latter checks the environment variables + :envvar:`LOGNAME` or :envvar:`USERNAME` to find out who the user is, and + falls back to ``pwd.getpwuid(os.getuid())[0]`` to get the login name of the + current real user id. Availability: Unix, Windows. |