-
Notifications
You must be signed in to change notification settings - Fork 6
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lua-implementation of pdf@shellescape should be reconsidered. #20
Comments
On 21 February 2017 at 10:25, u-fischer ***@***.***> wrote:
Starting from a question on tex.sx
https://tex.stackexchange.com/questions/354830/lualatex-
compilation-fails-when-sorting-text-using-luacode
the following minimal example was created. It fails with the error
)...xlive/2016/texmf-dist/tex/luatex/lualibs/lualibs-lua.lua:195: standard outpu
t file is closed
The error is caused by the faulty definition of sort_tdo which doesn't
restore correctly the output handler but also leads to the question if the
lua implementation of ***@***.*** in oberdiek.pdftexcmds.lua should
be reconsidered to use a less fragile method.
\documentclass{article}
\directlua{
function sort_tdo (jobname)
file=io.open(jobname.."sorted", "w")
% zz=io.output() %store output
io.output(file)
io.close(file)
% io.output(zz) %restore output
end
}
\directlua{
function shellescape()
if os.execute then
tex.write(os.execute())
end
end}
\directlua{sort_tdo("\jobname.tdo")}
\makeatletter
***@***.***{\directlua{tex.sprint(status.shell_escape .. " ")}} %works
***@***.***{\directlua{shellescape()}}% breaks
***@***.***>0 %
\show\x
\fi
\begin{document}
\end{document}
Thanks yes. Also I suspect it could be better as
\protected\edef\pdf@shellescape{\directlua{tex.sprint(status.shell_escape
.. " ")}}
so you only do it once, at a point known to be safe. this is read only
so can't change during
a run anyway
or perhaps
\protected\edef\pdf@shellescape{\numexpr\directlua{tex.sprint(status.shell_escape)}\relax}
To avoid the slightly risky space and so \the\pdf@shellescape works
|
davidcarlisle
added a commit
that referenced
this issue
Mar 19, 2017
davidcarlisle
added a commit
that referenced
this issue
Mar 19, 2017
the new pdf@shellescape is in the last ctan release, thanks for the comment. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Starting from a question on tex.sx
https://tex.stackexchange.com/questions/354830/lualatex-compilation-fails-when-sorting-text-using-luacode
the following minimal example was created. It fails with the error
The error is caused by the faulty definition of
sort_tdo
which doesn't restore correctly the output handler but also leads to the question if the lua implementation of\pdf@shellescape
inoberdiek.pdftexcmds.lua
should be reconsidered to use a less fragile method.The text was updated successfully, but these errors were encountered: