summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/link.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-03-16 23:41:46 +0800
committerruki <[email protected]>2020-03-16 16:10:41 +0800
commiteab12862d905574ada90a75af8ccf246be152ea4 (patch)
tree509bd30246119c5f8900ac15971b25aa19388834 /xmake/modules/core/tools/link.lua
parent83d289acd55263bce45a3d3ebe389b84bdd27a1f (diff)
fix link errors output
Diffstat (limited to 'xmake/modules/core/tools/link.lua')
-rw-r--r--xmake/modules/core/tools/link.lua25
1 files changed, 23 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua
index c9df9c630..b45f3c7a9 100644
--- a/xmake/modules/core/tools/link.lua
+++ b/xmake/modules/core/tools/link.lua
@@ -113,7 +113,28 @@ function link(self, objectfiles, targetkind, targetfile, flags, opt)
-- ensure the target directory
os.mkdir(path.directory(targetfile))
- -- use vstool to link and enable vs_unicode_output @see https://github.com/xmake-io/xmake/issues/528
- vstool.runv(linkargv(self, objectfiles, targetkind, targetfile, flags, opt))
+ try
+ {
+ function ()
+
+ -- use vstool to link and enable vs_unicode_output @see https://github.com/xmake-io/xmake/issues/528
+ vstool.runv(linkargv(self, objectfiles, targetkind, targetfile, flags, opt))
+ end,
+ catch
+ {
+ function (errors)
+
+ -- use link/stdout as errors first from vstool.iorunv()
+ if type(errors) == "table" then
+ local errs = errors.stdout or ""
+ if #errs:trim() == 0 then
+ errs = errors.stderr or ""
+ end
+ errors = errs
+ end
+ os.raise(tostring(errors))
+ end
+ }
+ }
end