From 521af253ea6c56c61b32885ccc25203a80680e15 Mon Sep 17 00:00:00 2001 From: Valentin Gologuzov Date: Jun 16 2016 12:35:00 +0000 Subject: Get correct login without TTY Use pwd.getpwuid(os.getuid())[0] instead of os.getlogin() to make pyrpkg usable without tty. Signed-off-by: Lubomír Sedlář --- diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py index 29faf10..142dd60 100644 --- a/src/pyrpkg/__init__.py +++ b/src/pyrpkg/__init__.py @@ -11,6 +11,7 @@ import errno import os +import pwd import sys import shutil import re @@ -781,7 +782,7 @@ class Commands(object): # If a site figures out the user differently (like from ssl cert) # this is where you'd override and make that happen - self._user = os.getlogin() + self._user = pwd.getpwuid(os.getuid())[0] @property def password(self):