diff options
| author | ruki <[email protected]> | 2019-08-20 23:27:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-08-20 14:43:42 +0800 |
| commit | da11852ee8510e46ba0436ab125d0d89d6c1f728 (patch) | |
| tree | 1a0cf14cbb81d471a2eb52c0cc82d35944142b40 /xmake/core/base/os.lua | |
| parent | 22a22766a667c3273fc4a4a2e58ce55aba8466b3 (diff) | |
pass stdout and stderr file to os.execv
Diffstat (limited to 'xmake/core/base/os.lua')
| -rw-r--r-- | xmake/core/base/os.lua | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 506cd7da2..5626c0c5d 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -638,12 +638,10 @@ function os.execv(program, argv, opt) -- uses the given environments? local envs = nil - if opt.envs or opt.vs_unicode_output then + if opt.envs then local envars = os.getenvs() - if opt.envs then - for k, v in pairs(opt.envs) do - envars[k] = v - end + for k, v in pairs(opt.envs) do + envars[k] = v end envs = {} for k, v in pairs(envars) do @@ -651,9 +649,22 @@ function os.execv(program, argv, opt) end end + -- init open options + local openopt = {envs = envs} + if type(opt.stdout) == "table" then + openopt.outfile = opt.stdout._FILE + else + openopt.outpath = opt.stdout + end + if type(opt.stderr) == "table" then + openopt.errfile = opt.stderr._FILE + else + openopt.errpath = opt.stderr + end + -- open command local ok = -1 - local proc = process.openv(filename, argv, {outpath = opt.stdout, errpath = opt.stderr, envs = envs, vs_unicode_output = opt.vs_unicode_output}) + local proc = process.openv(filename, argv, openopt) if proc ~= nil then -- wait process |
