summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-05-12 00:57:33 +0800
committerruki <[email protected]>2021-05-12 00:57:33 +0800
commitf930bdd0ad273d221bdf30079d8132e10deb6bf1 (patch)
tree20aac42db46c5d3b1101e843249fc2d4d395ca24
parent42c8a907e5a374d17b68cdf22f1d29a6a52dafbb (diff)
fix getenvs
-rw-r--r--xmake/core/base/os.lua27
1 files changed, 11 insertions, 16 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index d62f689ef..e26ac9956 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -193,7 +193,6 @@ end
-- notify envs have been changed
function os._notify_envs_changed(envs)
- os._CURENVS = nil
if os._SCHED_CHENVS then
os._SCHED_CHENVS(envs)
end
@@ -1000,23 +999,19 @@ end
-- get all current environment variables
-- e.g. envs["PATH"] = "/xxx:/yyy/foo"
function os.getenvs()
- local envs --= os._CURENVS
- if not envs 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()
- if os.host() == "windows" 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()
+ if os.host() == "windows" then
+ key = key:upper()
+ end
+ local values = line:sub(p + 1):trim()
+ if #key > 0 then
+ envs[key] = values
end
end
- os._CURENVS = envs
end
return envs
end