New submission from Amos S <amos.shap...@gmail.com>:

When doing "sudo python-script.py", the output of "getpass.getuser()" is pretty 
much useless for what it's used (I assume mainly logging and tracking purposes, 
that's what we use it for ourselves).

I worked around this limitation by using it in expression likes:

  username = os.environ.get("SUDO_USER") or getpass.getuser()

I think it'll be useful to many other users if getpass.getuser() could 
integrate this behavior.

I'd love to provide the code change if this is approved.

----------
messages: 325511
nosy: Amos S
priority: normal
severity: normal
status: open
title: Suggestion: make getuser.getpass() also look at SUDO_USER environment 
variable
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34709>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to