summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-04-27 00:34:05 +0800
committerruki <[email protected]>2019-04-26 21:24:31 +0800
commit2b9fa9538efda1b9bb95674c510afd3082330971 (patch)
tree9e75b279da6696a8f5e3f2222744ff16951040da
parent2c52aa3ecd3c16da67a266d5a63ded6c4bd9fdd8 (diff)
pass envs to os.execv
-rw-r--r--xmake/core/base/os.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index c20b8ac25..d63cefad3 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -580,7 +580,8 @@ end
-- @param program "clang", "xcrun -sdk macosx clang", "~/dir/test\ xxx/clang"
-- filename "clang", "xcrun"", "~/dir/test\ xxx/clang"
-- @param argv the arguments
--- @param opt the options, .e.g {wildcards = false, stdout = outfile, stderr = errfile, envs = {"PATH=xxx;xx", "CFLAGS=xx"}}
+-- @param opt the options, .e.g {wildcards = false, stdout = outfile, stderr = errfile,
+-- envs = {PATH = "xxx;xx", CFLAGS = "xx"}}
--
function os.execv(program, argv, opt)
@@ -608,9 +609,18 @@ function os.execv(program, argv, opt)
end
end
+ -- uses the given environments?
+ local envs = nil
+ if opt.envs then
+ envs = {}
+ for k, v in pairs(opt.envs) do
+ table.insert(envs, k .. '=' .. v)
+ end
+ end
+
-- open command
local ok = -1
- local proc = process.openv(filename, argv, opt.stdout, opt.stderr, opt.envs)
+ local proc = process.openv(filename, argv, opt.stdout, opt.stderr, envs)
if proc ~= nil then
-- wait process