]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests/servers.pm: add more ways to figure out current user
authorDaniel Stenberg <daniel@haxx.se>
Thu, 5 Jun 2025 21:37:59 +0000 (23:37 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 6 Jun 2025 21:07:29 +0000 (23:07 +0200)
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

index 29e214de30c2ba104f97995f2f5f74dcf1e1ba41..9a2c57dcdf822a12f56c70652b34c3618f8a6437 100644 (file)
@@ -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();
 }