diff options
| author | ruki <[email protected]> | 2022-04-05 23:37:32 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-05 23:37:32 +0800 |
| commit | 4724bc52df2b22357103d6569f9664c5651a3ebe (patch) | |
| tree | cd184820e9d10c707e18a5ed15d0594e54306f6f /xmake/core | |
| parent | 0125ddfe80f8d8fee5ea55fe1ed2f45acf188997 (diff) | |
improve get uid
Diffstat (limited to 'xmake/core')
| -rw-r--r-- | xmake/core/base/os.lua | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 823d3d009..39530eb0f 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -31,8 +31,8 @@ local string = require("base/string") local process = require("base/process") -- save original interfaces -os._uid = os._uid or os.uid -os._gid = os._gid or os.gid +os._getuid = os._getuid or os.getuid or os.uid -- for old core +os._getgid = os._getgid or os.getgid or os.gid os._exit = os._exit or os.exit os._mkdir = os._mkdir or os.mkdir os._rmdir = os._rmdir or os.rmdir @@ -609,7 +609,7 @@ function os.tmpdir(opt) local subdir = os._TMPSUBDIR if not subdir then local name = "." .. xmake._NAME - subdir = path.join((os._FAKEROOT and (name .. "fake") or name) .. (os.uid().euid or ""), os.date("%y%m%d")) + subdir = path.join((os._FAKEROOT and (name .. "fake") or name) .. (os.getuid().euid or ""), os.date("%y%m%d")) os._TMPSUBDIR = subdir end @@ -974,26 +974,26 @@ function os.nuldev(input) end -- get uid -function os.uid(...) +function os.getuid(...) os._UID = {} - if os._uid then - os._UID = os._uid(...) or {} + if os._getuid then + os._UID = os._getuid(...) or {} end return os._UID end -- get gid -function os.gid(...) +function os.getgid(...) os._GID = {} - if os._gid then - os._GID = os._gid(...) or {} + if os._getgid then + os._GID = os._getgid(...) or {} end return os._GID end -- check the current command is running as root function os.isroot() - return os.uid().euid == 0 + return os.getuid().euid == 0 end -- is case-insensitive filesystem? |
