Fall back to getuid if geteuid is not available

It appears to be missing in PyPy3
This commit is contained in:
ZyX 2014-12-08 20:00:46 +03:00
parent 8ae3d2aeaf
commit c617dbe6d8
1 changed files with 6 additions and 1 deletions

View File

@ -134,8 +134,13 @@ except ImportError:
except ImportError:
from getpass import getuser as _get_user
else:
try:
from os import geteuid as getuid
except ImportError:
from os import getuid
def _get_user():
return pwd.getpwuid(os.geteuid()).pw_name
return pwd.getpwuid(getuid()).pw_name
username = False