summaryrefslogtreecommitdiff
path: root/xmake/core/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-05-21 21:33:30 +0800
committerruki <[email protected]>2017-05-21 21:33:30 +0800
commit83f448dc569b70410765dfe6241fabc351feb54f (patch)
tree7bd1762bf8235d535980ff8223df6c50048a7365 /xmake/core/main.lua
parentb173fc383b9b1e80f0cbd2229d7b6d46ff75f0b6 (diff)
fix write nuldev bug as root
Diffstat (limited to 'xmake/core/main.lua')
-rw-r--r--xmake/core/main.lua29
1 files changed, 6 insertions, 23 deletions
diff --git a/xmake/core/main.lua b/xmake/core/main.lua
index a809fc508..b4ca6afab 100644
--- a/xmake/core/main.lua
+++ b/xmake/core/main.lua
@@ -127,26 +127,6 @@ function main._init()
end
end
--- check run command as root
-function main._check_root()
-
- -- TODO not check
- if xmake._HOST == "windows" then
- return true
- end
-
- -- check it
- local ok, code = os.iorun("id -u")
- if ok and code and code:trim() == '0' then
- return false, [[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.]]
- end
-
- -- not root
- return true
-end
-
-- the main function
function main.done()
@@ -162,9 +142,12 @@ function main.done()
-- check run command as root
if not option.get("root") then
- local ok, errors = main._check_root()
- if not ok then
- utils.error(errors)
+ if 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
end
end