From f0d0d54a71d3850423e25e46b76c1b468ebdd1ff Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 29 Mar 2019 23:25:27 +0800 Subject: save download and install errors for package --- xmake/actions/require/impl/action/download.lua | 10 +++++++--- xmake/actions/require/impl/action/install.lua | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/xmake/actions/require/impl/action/download.lua b/xmake/actions/require/impl/action/download.lua index 9ce7ac026..36518b248 100644 --- a/xmake/actions/require/impl/action/download.lua +++ b/xmake/actions/require/impl/action/download.lua @@ -208,9 +208,13 @@ function main(package) { function (errors) - -- verbose? - if (option.get("verbose") or option.get("diagnosis")) and errors then - cprint("${dim color.error}error: ${clear}%s", errors) + -- show or save the last errors + if errors then + if (option.get("verbose") or option.get("diagnosis")) then + cprint("${dim color.error}error: ${clear}%s", errors) + else + io.writefile(path.join(package:installdir("logs"), "download.txt"), errors) + end end -- trace diff --git a/xmake/actions/require/impl/action/install.lua b/xmake/actions/require/impl/action/install.lua index 2f4efed87..0fbac911c 100644 --- a/xmake/actions/require/impl/action/install.lua +++ b/xmake/actions/require/impl/action/install.lua @@ -225,9 +225,13 @@ function main(package) { function (errors) - -- verbose? - if (option.get("verbose") or option.get("diagnosis")) and errors then - cprint("${dim color.error}error: ${clear}%s", errors) + -- show or save the last errors + if errors then + if (option.get("verbose") or option.get("diagnosis")) then + cprint("${dim color.error}error: ${clear}%s", errors) + else + io.writefile(path.join(package:installdir("logs"), "install.txt"), errors) + end end -- trace -- cgit v1.3.1