Skip to content

Commit 0bd284b

Browse files
committed
fix: os.getlogin fails with OSError in CI.
1 parent 41fa7cc commit 0bd284b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

roundup/logcontext.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ def wrapper(*args, **kwargs):
152152
elif location == "mailgw":
153153
reason = args[1].get_header('message-id', "no_message_id")
154154
elif location == "admin":
155-
reason = "roundup-admin(%s): %s" % (os.getlogin(), args[1][:2])
155+
try:
156+
login = os.getlogin()
157+
except OSError:
158+
login = "unknown"
159+
reason = "roundup-admin(%s): %s" % (login, args[1][:2])
156160
elif location.startswith("file://"):
157161
reason = location
158162
elif location == "client_main" and 'REQUEST_URI' in args[0].env:

0 commit comments

Comments
 (0)