From b5fa0137f5047f1d41596d2077f05770708a758c Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 9 Dec 2024 23:15:05 +0800 Subject: improve to install package errors --- .../private/action/require/impl/actions/install.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua index 3b7a5e04e..5e0c2c542 100644 --- a/xmake/modules/private/action/require/impl/actions/install.lua +++ b/xmake/modules/private/action/require/impl/actions/install.lua @@ -542,17 +542,21 @@ function main(package) -- failed if not package:requireinfo().optional then if os.isfile(errorfile) then - if errors then - print("") - for idx, line in ipairs(errors:split("\n")) do - print(line) - if idx > 16 then - break + if errors and option.get("diagnosis") then + print(tostring(errors)) + else + if errors then + print("") + for idx, line in ipairs(errors:split("\n")) do + print(line) + if idx > 16 then + break + end end end + cprint("if you want to get more verbose errors, please see:") + cprint(" -> ${bright}%s", errorfile) end - cprint("if you want to get more verbose errors, please see:") - cprint(" -> ${bright}%s", errorfile) end raise("install failed!") end -- cgit v1.3.1