From d8c8e7a34559509ef52a0a7ff73bf8f37da82936 Mon Sep 17 00:00:00 2001 From: Valentin Gologuzov Date: Jul 23 2015 16:04:59 +0000 Subject: Use pwd.getpwuid(os.getuid())[0] instead of os.getlogin() to make pyrpkg usable without tty. --- diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py index 2d3d3db..4f1bd0c 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 @@ -714,7 +715,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):