diff options
| author | Arthur LAURENT <[email protected]> | 2024-01-30 17:04:35 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-01-30 17:10:18 +0100 |
| commit | a2ccc580a274200d889d199094e7201076594f0d (patch) | |
| tree | 46a6bbeb2c1cfafb9fbd36f7a627610d57ce49ed /xmake/rules/c++/modules/modules_support/msvc | |
| parent | 7e1cf4ff6bfb9ba73dd7c99c3f1b5d4017bb057b (diff) | |
use try{} instead of assert to preserve iorunv error colors
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/msvc')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/msvc/builder.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/xmake/rules/c++/modules/modules_support/msvc/builder.lua b/xmake/rules/c++/modules/modules_support/msvc/builder.lua index 3b295ca6b..929b0cd5d 100644 --- a/xmake/rules/c++/modules/modules_support/msvc/builder.lua +++ b/xmake/rules/c++/modules/modules_support/msvc/builder.lua @@ -86,7 +86,7 @@ function _compile(target, flags, sourcefile) if not dryrun then -- do compile - assert(os.iorunv(compinst:program(), flags, {envs = msvc:runenvs()})) + try{function() return os.iorunv(compinst:program(), flags, {envs = msvc:runenvs()}) end} end end diff --git a/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua b/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua index ed5027e22..6cf095a01 100644 --- a/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua +++ b/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua @@ -48,14 +48,14 @@ function generate_dependencies(target, sourcebatch, opt) local compinst = target:compiler("cxx") local msvc = target:toolchain("msvc") local compflags = table.join(compinst:compflags({sourcefile = sourcefile, target = target}) or {}, common_flags, flags) - os.vrunv(compinst:program(), winos.cmdargv(compflags), {envs = msvc:runenvs()}) + try{function() return os.iorunv(compinst:program(), winos.cmdargv(compflags), {envs = msvc:runenvs()}) end} else fallback_generate_dependencies(target, jsonfile, sourcefile, function(file) local compinst = target:compiler("cxx") local compflags = compinst:compflags({sourcefile = file, target = target}) local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) - os.vrunv(compinst:program(), table.join(compflags, - {"/P", "-TP", file, "/Fi" .. ifile}), {envs = msvc:runenvs()}) + try{function() return os.vrunv(compinst:program(), table.join(compflags, + {"/P", "-TP", file, "/Fi" .. ifile}), {envs = msvc:runenvs()}) end} local content = io.readfile(ifile) os.rm(ifile) return content |
