mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-06-08 08:42:14 +02:00
use fallback for posix_getpwuid on Windows
This commit is contained in:
parent
e30de6b719
commit
df248dd1b0
|
@ -517,6 +517,11 @@ class Runtime
|
||||||
*/
|
*/
|
||||||
public function getCurrentUser()
|
public function getCurrentUser()
|
||||||
{
|
{
|
||||||
|
// 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