diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2023-12-12 18:31:43 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2023-12-12 19:01:12 -0300 |
commit | 780d5e7828fef17b79a421ce4a6e131514e6a288 (patch) | |
tree | 70e68952a24a29cca9006cc0345e4f3ccc363081 | |
parent | f4b1deab270a94778e1bd8903ff48387b0ed9fbc (diff) | |
download | luarocks-780d5e7828fef17b79a421ce4a6e131514e6a288.tar.gz luarocks-780d5e7828fef17b79a421ce4a6e131514e6a288.tar.bz2 luarocks-780d5e7828fef17b79a421ce4a6e131514e6a288.zip |
fs.tools: do not cd to initial directory
Fixes #1545
-rw-r--r-- | src/luarocks/fs/tools.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/luarocks/fs/tools.lua b/src/luarocks/fs/tools.lua index 5c317f65..ff29ea39 100644 --- a/src/luarocks/fs/tools.lua +++ b/src/luarocks/fs/tools.lua | |||
@@ -64,7 +64,7 @@ do | |||
64 | for _, directory in ipairs(dir_stack) do | 64 | for _, directory in ipairs(dir_stack) do |
65 | current = fs.absolute_name(directory, current) | 65 | current = fs.absolute_name(directory, current) |
66 | end | 66 | end |
67 | return current | 67 | return current, cache_pwd |
68 | end | 68 | end |
69 | end | 69 | end |
70 | 70 | ||
@@ -107,9 +107,11 @@ end | |||
107 | -- @return boolean: true if command succeeds (status code 0), false | 107 | -- @return boolean: true if command succeeds (status code 0), false |
108 | -- otherwise. | 108 | -- otherwise. |
109 | function tools.execute_string(cmd) | 109 | function tools.execute_string(cmd) |
110 | local current = fs.current_dir() | 110 | local current, cache_pwd = fs.current_dir() |
111 | if not current then return false end | 111 | if not current then return false end |
112 | cmd = fs.command_at(current, cmd) | 112 | if current ~= cache_pwd then |
113 | cmd = fs.command_at(current, cmd) | ||
114 | end | ||
113 | local code = os.execute(cmd) | 115 | local code = os.execute(cmd) |
114 | if code == 0 or code == true then | 116 | if code == 0 or code == true then |
115 | return true | 117 | return true |