summaryrefslogtreecommitdiff
path: root/shellutils.py
diff options
context:
space:
mode:
authorAurelien Campeas <aurelien.campeas@logilab.fr>2009-11-16 14:26:51 +0100
committerAurelien Campeas <aurelien.campeas@logilab.fr>2009-11-16 14:26:51 +0100
commite38afc9f25a8d1008bd67a1f678d00806dabc2ab (patch)
tree53bc61d35554cbd5b80e969f9ed31a733dacbcb6 /shellutils.py
parent1b4d12cbd2ab6e6e586743df592648faa42fa26e (diff)
downloadlogilab-common-e38afc9f25a8d1008bd67a1f678d00806dabc2ab.tar.gz
ensure getlogin works under windows
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 4a6d3c3..5c22a0e 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']