From 90cdfd82d7f32dbf826516a0438faefda12c5162 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 17 Dec 2023 21:47:13 +0800 Subject: Update main.lua --- xmake/core/main.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'xmake/core/main.lua') diff --git a/xmake/core/main.lua b/xmake/core/main.lua index f3412d1d1..e813c849a 100644 --- a/xmake/core/main.lua +++ b/xmake/core/main.lua @@ -238,6 +238,11 @@ function main._exit(ok, errors) return retval end +-- limit root? @see https://github.com/xmake-io/xmake/pull/4513 +function main._limit_root() + return not option.get("root") and os.getenv("XMAKE_ROOT") ~= 'y' and os.host() ~= 'haiku' +end + -- the main entry function function main.entry() @@ -266,7 +271,7 @@ function main.entry() end -- check run command as root - if not option.get("root") and os.getenv("XMAKE_ROOT") ~= 'y' and os.host() ~= 'haiku' then + if main._limit_root() then if os.isroot() then errors = [[Running xmake as root is extremely dangerous and no longer supported. As xmake does not drop privileges on installation you would be giving all -- cgit v1.3.1