Skip to content
Snippets Groups Projects
Commit 0ad889f5 authored by Alan De Smet's avatar Alan De Smet
Browse files

CI: Try to run as nobody if running as root

One of the tests relies on there being a file we cannot update the update time on, which doesn't work as root.
parent e7f17f01
No related branches found
No related tags found
No related merge requests found
......@@ -1121,4 +1121,12 @@ if __name__ == '__main__':
import logging
#logging.basicConfig(format='%(process)d:%(levelname)s:%(message)s', level=logging.DEBUG)
if os.getuid() == 0:
import pwd
try:
pwent = pwd.getpwnam("nobody")
except KeyError:
raise Exception("Running as root; tried to switch to 'nobody', but there is no account by that name")
os.setuid(pwent.pw_uid)
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment