summaryrefslogtreecommitdiff
path: root/xmake/core/main.lua
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-22 19:37:24 +0800
committerTitanSnow <[email protected]>2017-05-22 19:37:24 +0800
commitbd775f017f77043aac5b6290c9899f7daf23e172 (patch)
tree9415a16fbdaa99b5f33470aa66332b58b4b19e8b /xmake/core/main.lua
parentb8e4fb467d8de881749e3bc77493728a642ff145 (diff)
add module privilege to manage root privilege
Diffstat (limited to 'xmake/core/main.lua')
-rw-r--r--xmake/core/main.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/xmake/core/main.lua b/xmake/core/main.lua
index b4ca6afab..cda338294 100644
--- a/xmake/core/main.lua
+++ b/xmake/core/main.lua
@@ -32,6 +32,7 @@ local utils = require("base/utils")
local option = require("base/option")
local profiler = require("base/profiler")
local deprecated = require("base/deprecated")
+local privilege = require("base/privilege")
local task = require("project/task")
local history = require("project/history")
@@ -143,12 +144,14 @@ function main.done()
-- check run command as root
if not option.get("root") then
if os.isroot() then
- utils.error([[Running xmake as root is extremely dangerous and no longer supported.
+ if not privilege.store() or os.isroot() then
+ utils.error([[Running xmake as root is extremely dangerous and no longer supported.
As xmake does not drop privileges on installation you would be giving all
build scripts full access to your system.
Or you can add `--root` option to allow run as root temporarily.
- ]])
- return -1
+ ]])
+ return -1
+ end
end
end