[luatex] How to detect option '--shell-escape'?

David Carlisle d.p.carlisle at gmail.com
Sat Oct 7 14:20:59 CEST 2023


look at  status.shell_escape  from Lua  (you can see the latex
tools/shellesc.sty (which also works with plain) for an example:

\chardef\ShellEscapeStatus
  \ifx\pdfshellescape\@undefined
    \ifx\shellescape\@undefined
      \ifx\directlua\@undefined
        \z@
      \else
        \directlua{%
          tex.sprint((status.shell_escape or os.execute()) .. " ")}
      \fi
    \else
      \shellescape
    \fi
  \else
    \pdfshellescape
  \fi

On Sat, 7 Oct 2023 at 12:46, Andreas Scherer <andreas_tex at freenet.de> wrote:

> Dear all,
>
> According to the LuaTeX Reference, primitive '\pdfshellescape' has been
> removed and "can be implemented using Lua".
>
> What would be a canonical way to implement this code (from 'pwebmac.tex')
>
>    \ifpdftex \ifnum\pdfshellescape=1 {\let\\=\BS
>      \global\countD=\input{|grep -c -e '\\:\\X' \jobname.tex}} \fi\fi
>
> for use with LuaTeX? Without the '\ifnum\pdfshellescape' part, but with
> 'luatex --shell-escape', the pipe is correctly executed.
>
> How can I detect option '--shell-escape' in my macro code?
>
> TIA,
> Andreas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20231007/da3f645e/attachment.htm>


More information about the luatex mailing list.