Merge pull request #11855 from nix-windows/fix-windows-env-var-arg-order

Fix argument order in the Windows implementation of `getEnvOs`
This commit is contained in:
Eelco Dolstra 2024-11-12 10:47:12 +01:00 committed by GitHub
commit 2e2198fd91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,7 @@ std::optional<OsString> getEnvOs(const OsString & key)
}
// Allocate a buffer to hold the environment variable value
std::wstring value{L'\0', bufferSize};
std::wstring value{bufferSize, L'\0'};
// Retrieve the environment variable value
DWORD resultSize = GetEnvironmentVariableW(key.c_str(), &value[0], bufferSize);