From f33ec60fbf7a7251aa4475812b2f57b47470bbf2 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 5 Jun 2025 23:37:59 +0200 Subject: [PATCH] tests/servers.pm: add more ways to figure out current user Some CI tests fail due to "Can't start ssh server due to lack of USER name" - add more ways to try to figure it out if no environment variable works: the whoami and id commands. Closes #17544 --- tests/servers.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/servers.pm b/tests/servers.pm index 29e214de30..9a2c57dcdf 100644 --- a/tests/servers.pm +++ b/tests/servers.pm @@ -209,9 +209,17 @@ sub initserverconfig { $USER = $ENV{USER}; # Linux if (!$USER) { $USER = $ENV{USERNAME}; # Windows - if (!$USER) { - $USER = $ENV{LOGNAME}; # Some Unix (I think) - } + } + if (!$USER) { + $USER = $ENV{LOGNAME}; # Some Unix (I think) + } + if (!$USER) { + $USER = `whoami`; + chomp $USER; + } + if (!$USER) { + $USER = `id -un`; + chomp $USER; } init_serverpidfile_hash(); } -- 2.47.2