diff options
| author | ruki <[email protected]> | 2025-09-27 00:45:48 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-09-27 00:45:48 +0800 |
| commit | 947491d0df87eafcbf8f560a1377f49a7b60a2db (patch) | |
| tree | 75b212b8428c8d65f882a59b1df3378e21c1c6ae | |
| parent | 91b87415d0666c388d5d2f8fada1164c095db098 (diff) | |
update envs
| -rw-r--r-- | xmake/core/base/os.lua | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 99b702ce8..57046813e 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -208,7 +208,6 @@ end -- notify envs have been changed function os._notify_envs_changed(envs) - os._ENVS = nil if os._SCHED_CHENVS then os._SCHED_CHENVS(envs) end @@ -1304,25 +1303,21 @@ end -- get all current environment variables -- e.g. envs["PATH"] = "/xxx:/yyy/foo" function os.getenvs() - local envs -- = os._ENVS - if envs == nil then - envs = {} - for _, line in ipairs(os._getenvs()) do - local p = line:find('=', 1, true) - if p then - local key = line:sub(1, p - 1):trim() - -- only translate Path to PATH on windows - -- @see https://github.com/xmake-io/xmake/issues/3752 - if os.host() == "windows" and key:lower() == "path" then - key = key:upper() - end - local values = line:sub(p + 1):trim() - if #key > 0 then - envs[key] = values - end + local envs = {} + for _, line in ipairs(os._getenvs()) do + local p = line:find('=', 1, true) + if p then + local key = line:sub(1, p - 1):trim() + -- only translate Path to PATH on windows + -- @see https://github.com/xmake-io/xmake/issues/3752 + if os.host() == "windows" and key:lower() == "path" then + key = key:upper() + end + local values = line:sub(p + 1):trim() + if #key > 0 then + envs[key] = values end end - os._ENVS = envs end return envs end |
