mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-06-07 16:22:15 +02:00
Merge pull request #427 from fritzmg/patch-1
Use fallback for posix_getpwuid on Windows
This commit is contained in:
commit
fc8da5b229
|
@ -471,6 +471,11 @@ class Runtime
|
||||||
*/
|
*/
|
||||||
public function getCurrentUser(): string
|
public function getCurrentUser(): string
|
||||||
{
|
{
|
||||||
|
// Windows fallback
|
||||||
|
if (!function_exists('posix_getpwuid')) {
|
||||||
|
return getenv('USERNAME') ?: '';
|
||||||
|
}
|
||||||
|
|
||||||
$userData = posix_getpwuid(posix_geteuid());
|
$userData = posix_getpwuid(posix_geteuid());
|
||||||
return $userData['name'];
|
return $userData['name'];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue