Skip to content

Commit 208f866

Browse files
committed
fix user detection on freebsd always returning root
1 parent 4356085 commit 208f866

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

archivebox/config.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import io
2626
import re
2727
import sys
28+
import pwd
2829
import json
2930
import getpass
3031
import platform
@@ -312,7 +313,7 @@ def get_real_name(key: str) -> str:
312313

313314
DYNAMIC_CONFIG_SCHEMA: ConfigDefaultDict = {
314315
'TERM_WIDTH': {'default': lambda c: lambda: shutil.get_terminal_size((100, 10)).columns},
315-
'USER': {'default': lambda c: getpass.getuser() or os.getlogin()},
316+
'USER': {'default': lambda c: pwd.getpwuid(os.geteuid()).pw_name or getpass.getuser() or os.getlogin()},
316317
'ANSI': {'default': lambda c: DEFAULT_CLI_COLORS if c['USE_COLOR'] else {k: '' for k in DEFAULT_CLI_COLORS.keys()}},
317318

318319
'PACKAGE_DIR': {'default': lambda c: Path(__file__).resolve().parent},

0 commit comments

Comments
 (0)