1
0
Fork 0

fix user detection on freebsd always returning root

This commit is contained in:
Nick Sweeting 2021-04-24 02:51:48 -04:00
parent 4356085a43
commit 208f866fc4

View file

@ -25,6 +25,7 @@ import os
import io
import re
import sys
import pwd
import json
import getpass
import platform
@ -312,7 +313,7 @@ ALLOWED_IN_OUTPUT_DIR = {
DYNAMIC_CONFIG_SCHEMA: ConfigDefaultDict = {
'TERM_WIDTH': {'default': lambda c: lambda: shutil.get_terminal_size((100, 10)).columns},
'USER': {'default': lambda c: getpass.getuser() or os.getlogin()},
'USER': {'default': lambda c: pwd.getpwuid(os.geteuid()).pw_name or getpass.getuser() or os.getlogin()},
'ANSI': {'default': lambda c: DEFAULT_CLI_COLORS if c['USE_COLOR'] else {k: '' for k in DEFAULT_CLI_COLORS.keys()}},
'PACKAGE_DIR': {'default': lambda c: Path(__file__).resolve().parent},