Don't use os.getlogin() since apparently it's unreliable.
authorZac Medico <zmedico@gentoo.org>
Tue, 10 Aug 2010 09:28:34 +0000 (02:28 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 10 Aug 2010 09:28:34 +0000 (02:28 -0700)
pym/portage/tests/runTests

index 9600f12a73ede5c5b0653fae340fabc18808755b..05dd773c9f31e916f945b88e49575cd928961caf 100755 (executable)
@@ -6,11 +6,12 @@
 import os, sys
 import os.path as osp
 import grp
+import pwd
 
 # Pretend that the current user's uid/gid are the 'portage' uid/gid,
 # so things go smoothly regardless of the current user and global
 # user/group configuration.
-os.environ["PORTAGE_USERNAME"] = os.getlogin()
+os.environ["PORTAGE_USERNAME"] = pwd.getpwuid(os.getuid()).pw_name
 os.environ["PORTAGE_GRPNAME"] = grp.getgrgid(os.getgid()).gr_name
 
 # Insert our parent dir so we can do shiny import "tests"