How do I set an environment variable for a Lua filter's os.execute
?
#11569
-
DescriptionI am using this Lua filter for rendering TikZ diagrams: https://github.com/danmackinlay/quarto_tikz/blob/main/_extensions/tikz/tikz.lua On this line, it calls local _, _, dvisvgmExitCode = os.execute("dvisvgm --font-format=woff " .. dviFile .. " -n -o " .. svgFile) My issue is that How may I have this environment variable set and available to Lua does not seem to have a I've tried the following unsuccessfully: local _, _, dvisvgmExitCode = os.execute("LIBGS=/usr/local/Cellar/ghostscript/10.04.0/lib/libgs.dylib dvisvgm --font-format=woff " .. dviFile .. " -n -o " .. svgFile) local _, _, dvisvgmExitCode = os.execute("export LIBGS=/usr/local/Cellar/ghostscript/10.04.0/lib/libgs.dylib; dvisvgm --font-format=woff " .. dviFile .. " -n -o " .. svgFile) local _, _, dvisvgmExitCode = os.execute("export LIBGS=/usr/local/Cellar/ghostscript/10.04.0/lib/libgs.dylib && dvisvgm --font-format=woff " .. dviFile .. " -n -o " .. svgFile) EDIT: I found a workaround to use the local _, _, dvisvgmExitCode = os.execute("dvisvgm --libgs=/usr/local/Cellar/ghostscript/10.04.0/lib/libgs.dylib --font-format=woff " .. dviFile .. " -n -o " .. svgFile) So I'm unblocked. Not sure if the original question still merits an answer. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Pandoc offers the function Usage: pandoc.system.with_environment(
{ LIBGS = "...." },
function ()
os.execute('...')
end
) |
Beta Was this translation helpful? Give feedback.
Pandoc offers the function
pandoc.system.with_environment
. The function doesn't seem to work reliably on Windows, but it might be good enough for many use-cases.Usage: