7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-06-09 09:12:21 +00:00

Don't even try to detect user properties on Windows

This commit is contained in:
Régis Behmo 2020-11-19 11:29:44 +01:00
parent 545e9af2dd
commit a4051302ad

View File

@ -130,6 +130,9 @@ def is_root():
"""
Check whether tutor is being run as root/sudo.
"""
if sys.platform == "win32":
# Don't even try
return False
return get_user_id() == 0
@ -138,7 +141,8 @@ def get_user_id():
Portable way to get user ID. Note: I have no idea if it actually works on windows...
"""
if sys.platform == "win32":
return int(check_output("id", "-u").decode())
# Don't even try
return 0
return os.getuid()