Merge pull request #427 from fritzmg/patch-1

Use fallback for posix_getpwuid on Windows
This commit is contained in:
Andrés Montañez 2022-04-10 18:43:22 -03:00 committed by GitHub
commit fc8da5b229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -471,6 +471,11 @@ class Runtime
*/
public function getCurrentUser(): string
{
// Windows fallback
if (!function_exists('posix_getpwuid')) {
return getenv('USERNAME') ?: '';
}
$userData = posix_getpwuid(posix_geteuid());
return $userData['name'];
}