summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-25 08:29:34 +0800
committerTitanSnow <[email protected]>2017-05-25 08:29:34 +0800
commit578211e93c1f49f1b97772425a9724d3e3d5680e (patch)
tree7f93ef89bbc1a06a868c705174e4c0f2087c446e
parent0744b67c8e4cbf92ec9fd8bbaedbe35d213b864b (diff)
fix sudo PATH passing
-rw-r--r--xmake/modules/privilege/sudo.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmake/modules/privilege/sudo.lua b/xmake/modules/privilege/sudo.lua
index ae35ee23a..099939fc9 100644
--- a/xmake/modules/privilege/sudo.lua
+++ b/xmake/modules/privilege/sudo.lua
@@ -37,8 +37,9 @@ function _sudo(runner, cmd, ...)
local program = find_sudo()
assert(program, "sudo not found!")
+ -- FIXME: deal with spaces in `os.getenv("PATH")`
-- run it with administrator permission and preserve parent environment
- runner(program .. " PATH=" .. os.getenv("PATH") .. " " .. cmd, ...)
+ runner(program .. " env PATH=" .. os.getenv("PATH") .. " " .. cmd, ...)
end
-- sudo run shell with administrator permission and arguments list
@@ -53,7 +54,7 @@ function _sudov(runner, shellname, argv)
assert(program, "sudo not found!")
-- run it with administrator permission and preserve parent environment
- runner(program, table.join("PATH=" .. os.getenv("PATH"), shellname, argv))
+ runner(program, table.join("env", "PATH=" .. os.getenv("PATH"), shellname, argv))
end
-- sudo run lua script with administrator permission and arguments list