Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Apr 18, 2024
1 parent 4278625 commit d66e8dc
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions xmake/core/base/os.lua
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,14 @@ function os.execv(program, argv, opt)
local addenvs = opt.addenvs
if setenvs or addenvs then
local envars = os.getenvs()
if program:find("MinExample") then
print("curenvs")
utils.dump(envars)
print("setenvs")
utils.dump(setenvs)
print("addenvs")
utils.dump(addenvs)
end
if setenvs then
for k, v in pairs(setenvs) do
if type(v) == "table" then
Expand All @@ -848,24 +856,50 @@ function os.execv(program, argv, opt)
end
if addenvs then
for k, v in pairs(addenvs) do
if program:find("MinExample") then
if k == "PATH" then
print("v1")
utils.dump(v)
end
end

if type(v) == "table" then
v = path.joinenv(v)
end
if type(v) == "string" and #v > 4096 and os.host() == "windows" then
v = os._deduplicate_pathenv(v)
if program:find("MinExample") then
if k == "PATH" then
print("v2", v)
end
end


local o = envars[k]
if o then
envars[k] = v .. path.envsep() .. o
else
envars[k] = v
v = v .. path.envsep() .. o
end
if type(v) == "string" and #v > 4096 and os.host() == "windows" then
v = os._deduplicate_pathenv(v)
end
envars[k] = v
if program:find("MinExample") then
if k == "PATH" then
print("o", o)
print("v", v)
print("envars[k]", envars[k])
end
end
end
end
envs = {}
for k, v in pairs(envars) do
table.insert(envs, k .. '=' .. v)
end
if program:find("MinExample") then
print("os.execv envars")
utils.dump(envars)
print("os.execv envs")
utils.dump(envs)
end
end

-- init open options
Expand Down

0 comments on commit d66e8dc

Please sign in to comment.