diff options
| author | TitanSnow <[email protected]> | 2017-05-25 08:29:34 +0800 |
|---|---|---|
| committer | TitanSnow <[email protected]> | 2017-05-25 08:29:34 +0800 |
| commit | 578211e93c1f49f1b97772425a9724d3e3d5680e (patch) | |
| tree | 7f93ef89bbc1a06a868c705174e4c0f2087c446e | |
| parent | 0744b67c8e4cbf92ec9fd8bbaedbe35d213b864b (diff) | |
fix sudo PATH passing
| -rw-r--r-- | xmake/modules/privilege/sudo.lua | 5 |
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 |
