diff options
| author | ruki <[email protected]> | 2020-01-08 23:53:09 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-01-08 17:18:58 +0800 |
| commit | 1c850b2aea9878a53417403a3e2dcaad6fe01e1f (patch) | |
| tree | c509ed09d3d40f5f0a70b3f5515e5453dec5e25e | |
| parent | e770a3e357e740beda4ebd13cf722998a540893f (diff) | |
improve to install and uninstall
| -rw-r--r-- | xmake/actions/install/main.lua | 9 | ||||
| -rw-r--r-- | xmake/actions/uninstall/main.lua | 6 |
2 files changed, 6 insertions, 9 deletions
diff --git a/xmake/actions/install/main.lua b/xmake/actions/install/main.lua index e4c3b5151..f278b4b3c 100644 --- a/xmake/actions/install/main.lua +++ b/xmake/actions/install/main.lua @@ -90,9 +90,6 @@ function main() -- failed or not permission? request administrator permission and install it again function (errors) - -- trace - vprint(errors) - -- try get privilege if privilege.get() then local ok = try @@ -117,10 +114,8 @@ function main() if ok then return end end - -- show tips - cprint("${bright color.error}error: ${clear}installation failed, may permission denied!") - -- continue to install with administrator permission? + local ok = false if sudo.has() then -- confirm to install? @@ -132,8 +127,10 @@ function main() -- trace cprint("${bright}install ok!${clear}") + ok = true end end + assert(ok, "install failed, error: %s", errors or "unknown") end } } diff --git a/xmake/actions/uninstall/main.lua b/xmake/actions/uninstall/main.lua index 877954558..dec19924f 100644 --- a/xmake/actions/uninstall/main.lua +++ b/xmake/actions/uninstall/main.lua @@ -76,10 +76,8 @@ function main() if ok then return end end - -- show tips - cprint("${bright color.error}error: ${clear}failed to uninstall, may permission denied!") - -- continue to uninstall with administrator permission? + local ok = false if sudo.has() then -- confirm to uninstall? @@ -91,8 +89,10 @@ function main() -- trace cprint("${bright}uninstall ok!${clear}") + ok = true end end + assert(ok, "uninstall failed, error: %s", errors or "unknown") end } } |
