From 7f970bfabcc2413cda468a8dbc435607c9a82e37 Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Wed, 19 Jan 2022 19:01:52 +0800 Subject: improve nvcc error output --- xmake/modules/core/tools/nvcc.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 471d62532..507077e08 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -347,8 +347,18 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) -- try removing the old object file for forcing to rebuild this source file os.tryrm(objectfile) + -- use nvcc/stdout as errors first from os.iorunv() + if type(errors) == "table" then + local errs = errors.stdout or "" + if #errs:trim() == 0 then + errs = errors.stderr or "" + end + errors = errs + else + errors = tostring(errors) + end + -- find the start line of error - errors = tostring(errors) local lines = errors:split("\n", {plain = true}) local start = 0 for index, line in ipairs(lines) do -- cgit v1.3.1