summaryrefslogtreecommitdiff
path: root/shellutils.py
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2009-12-04 08:38:06 +0100
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2009-12-04 08:38:06 +0100
commitb96951d6a140b92d033a8d9eb53614e22e30c2c5 (patch)
tree4704a00f5fa5dbec23a00318e55e8b93828b2fa5 /shellutils.py
parent11c747eeb4c3109d357f21b745a7d37dd039a664 (diff)
parente38afc9f25a8d1008bd67a1f678d00806dabc2ab (diff)
downloadlogilab-common-b96951d6a140b92d033a8d9eb53614e22e30c2c5.tar.gz
merge
Diffstat (limited to 'shellutils.py')
-rw-r--r--shellutils.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/shellutils.py b/shellutils.py
index ed5d23f..d012bbe 100644
--- a/shellutils.py
+++ b/shellutils.py
@@ -339,8 +339,9 @@ def getlogin():
(man 3 getlogin)
Another solution would be to use $LOGNAME, $USER or $USERNAME
"""
- import pwd # Platforms: Unix
- return pwd.getpwuid(os.getuid())[0]
-
-
+ if sys.platform != 'win32':
+ import pwd # Platforms: Unix
+ return pwd.getpwuid(os.getuid())[0]
+ else:
+ return os.environ['USERNAME']