Remove environment variables with plat_setenv(name, NULL) and set them through the C runtime on Windows, so getenv sees every change and --probe-cfg passes on Linux.

This commit is contained in:
Wellington Dias committed 2026-10-31 02:02:27 -03:00
1 parent efe1b5db54
commit a4c99a47b0
3 files changed
+18 -16

No files matched your search

+3 -1
View File
@@ -621,7 +621,9 @@ void plat_exit(int code) {
ExitProcess((UINT)code);
}
int plat_setenv(const char *name, const char *value) { return SetEnvironmentVariableA(name, value) != 0; }
// _putenv_s, not SetEnvironmentVariableA: getenv reads the C runtime's copy of the environment, which only the CRT's
// own calls update. An empty value removes the variable.
int plat_setenv(const char *name, const char *value) { return _putenv_s(name, value ? value : "") == 0; }
uint32_t plat_process_id(void) { return GetCurrentProcessId(); }