summaryrefslogtreecommitdiff
path: root/xmake/modules/privilege/sudo.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-05-24 21:03:43 +0800
committerruki <[email protected]>2017-05-24 21:03:43 +0800
commit2d075777fd3ab515f508eedf08dd596ac9fdda93 (patch)
tree42202806994a86226553816f56b2fc2e4f4d5c13 /xmake/modules/privilege/sudo.lua
parent7ef69739513b4b4431f6f683fe2a9d297658be02 (diff)
improve sudo and build test script
Diffstat (limited to 'xmake/modules/privilege/sudo.lua')
-rw-r--r--xmake/modules/privilege/sudo.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/xmake/modules/privilege/sudo.lua b/xmake/modules/privilege/sudo.lua
index aba3a0362..ae35ee23a 100644
--- a/xmake/modules/privilege/sudo.lua
+++ b/xmake/modules/privilege/sudo.lua
@@ -37,10 +37,8 @@ function _sudo(runner, cmd, ...)
local program = find_sudo()
assert(program, "sudo not found!")
- -- TODO handle -E on ubuntu
-
-- run it with administrator permission and preserve parent environment
- runner(program .. " -E " .. cmd, ...)
+ runner(program .. " PATH=" .. os.getenv("PATH") .. " " .. cmd, ...)
end
-- sudo run shell with administrator permission and arguments list
@@ -55,7 +53,7 @@ function _sudov(runner, shellname, argv)
assert(program, "sudo not found!")
-- run it with administrator permission and preserve parent environment
- runner(program, table.join("-E", shellname, argv))
+ runner(program, table.join("PATH=" .. os.getenv("PATH"), shellname, argv))
end
-- sudo run lua script with administrator permission and arguments list