diff options
| author | ruki <[email protected]> | 2019-08-16 22:38:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-08-16 17:49:18 +0800 |
| commit | 7bf7eabafb4c7f4bc36bd3964a914358cd7bb46c (patch) | |
| tree | 95ab3093f5363a3715b6456a48302329ad47f819 /xmake | |
| parent | 524b4d10954233517fd25374b36c3e4080b29113 (diff) | |
improve process.openv
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/actions/build/cleaner.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/build/statistics.lua | 2 | ||||
| -rw-r--r-- | xmake/core/base/os.lua | 2 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/process.lua | 23 |
4 files changed, 14 insertions, 15 deletions
diff --git a/xmake/actions/build/cleaner.lua b/xmake/actions/build/cleaner.lua index 5b39f5542..db589491e 100644 --- a/xmake/actions/build/cleaner.lua +++ b/xmake/actions/build/cleaner.lua @@ -53,7 +53,7 @@ function cleanup() try { function () - local proc = process.openv("xmake", argv, path.join(os.tmpdir(), "cleaner.log")) + local proc = process.openv("xmake", argv, {outpath = path.join(os.tmpdir(), "cleaner.log")}) if proc ~= nil then process.close(proc) end diff --git a/xmake/actions/build/statistics.lua b/xmake/actions/build/statistics.lua index ebce99f13..4edcfe187 100644 --- a/xmake/actions/build/statistics.lua +++ b/xmake/actions/build/statistics.lua @@ -83,7 +83,7 @@ function post() try { function () - local proc = process.openv("xmake", argv, path.join(os.tmpdir(), projectname .. ".stats.log")) + local proc = process.openv("xmake", argv, {outpath = path.join(os.tmpdir(), projectname .. ".stats.log")}) if proc ~= nil then process.close(proc) end diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index b8a81c8bd..18dc682da 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -626,7 +626,7 @@ function os.execv(program, argv, opt) -- open command local ok = -1 - local proc = process.openv(filename, argv, opt.stdout, opt.stderr, envs) + local proc = process.openv(filename, argv, {outpath = opt.stdout, errpath = opt.stderr, envs = envs}) if proc ~= nil then -- wait process diff --git a/xmake/core/sandbox/modules/process.lua b/xmake/core/sandbox/modules/process.lua index f1d73cb00..3a4faa31d 100644 --- a/xmake/core/sandbox/modules/process.lua +++ b/xmake/core/sandbox/modules/process.lua @@ -28,6 +28,10 @@ local vformat = require("sandbox/modules/vformat") local sandbox_process = sandbox_process or {} -- open process +--- +-- @param command the command +-- @param opt the arguments option, {outpath = "", errpath = "", envs = {"PATH=xxx", "XXX=yyy"} +-- function sandbox_process.open(command, opt) -- check @@ -47,7 +51,12 @@ function sandbox_process.open(command, opt) end -- open process with arguments -function sandbox_process.openv(filename, argv, outfile, errfile) +-- +-- @param filename the command/file name +-- @param argv the command arguments +-- @param opt the arguments option, {outpath = "", errpath = "", envs = {"PATH=xxx", "XXX=yyy"} +-- +function sandbox_process.openv(filename, argv, opt) -- check assert(argv) @@ -55,18 +64,8 @@ function sandbox_process.openv(filename, argv, outfile, errfile) -- format filename first filename = vformat(filename) - -- format output file if exists - if outfile then - outfile = vformat(outfile) - end - - -- format error file if exists - if errfile then - errfile = vformat(errfile) - end - -- open process - local proc = process.openv(filename, argv, outfile, errfile) + local proc = process.openv(filename, argv, opt) if not proc then raise("openv process(%s, %s) failed!", filename, table.concat(argv, " ")) end |
