diff options
-rw-r--r-- | src/luarocks/fs/lua.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 88fc31d9..8640b01a 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
@@ -89,6 +89,15 @@ function fs_lua.execute_quiet(command, ...) | |||
89 | end | 89 | end |
90 | end | 90 | end |
91 | 91 | ||
92 | function fs.execute_env(env, command, ...) | ||
93 | assert(type(command) == "string") | ||
94 | local envstr = {} | ||
95 | for var, val in pairs(env) do | ||
96 | table.insert(envstr, fs.export_cmd(var, val)) | ||
97 | end | ||
98 | return fs.execute_string(table.concat(envstr, "\n") .. "\n" .. quote_args(command, ...)) | ||
99 | end | ||
100 | |||
92 | --- Checks if the given tool is available. | 101 | --- Checks if the given tool is available. |
93 | -- The tool is executed using a flag, usually just to ask its version. | 102 | -- The tool is executed using a flag, usually just to ask its version. |
94 | -- @param tool_cmd string: The command to be used to check the tool's presence (e.g. hg in case of Mercurial) | 103 | -- @param tool_cmd string: The command to be used to check the tool's presence (e.g. hg in case of Mercurial) |