aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-06-24 19:14:17 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-07-01 15:51:35 -0300
commit9b0c5b56d39e5a405804ea477a5210fdba378e00 (patch)
tree871fe57553541c29d91ae0589d62a67a5019b179 /src
parenta1715807478ba5c2c16f8cf73eaf5f664aabdbcb (diff)
downloadluarocks-9b0c5b56d39e5a405804ea477a5210fdba378e00.tar.gz
luarocks-9b0c5b56d39e5a405804ea477a5210fdba378e00.tar.bz2
luarocks-9b0c5b56d39e5a405804ea477a5210fdba378e00.zip
fs: add execute_env: execute with environment variables
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/fs/lua.lua9
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
90end 90end
91 91
92function 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, ...))
99end
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)