diff options
author | Karl Berry <karl@freefriends.org> | 2019-11-06 22:12:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-11-06 22:12:38 +0000 |
commit | 7c55167ecf36309f45793303eea23651cb983f12 (patch) | |
tree | 11c014344f975231c0cb0ed300b892849a481db8 /Master/texmf-dist/tex/latex/tools/shellesc.sty | |
parent | 7b810bfb3e61d6cd1564c490490d6d005dd64813 (diff) |
l2e (6nov19)
git-svn-id: svn://tug.org/texlive/trunk@52656 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tools/shellesc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tools/shellesc.sty | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/latex/tools/shellesc.sty b/Master/texmf-dist/tex/latex/tools/shellesc.sty index d43eb9025ff..d7d0756fcbc 100644 --- a/Master/texmf-dist/tex/latex/tools/shellesc.sty +++ b/Master/texmf-dist/tex/latex/tools/shellesc.sty @@ -49,8 +49,12 @@ \ifx\PackageWarning\undefined\def\PackageWarning#1#2{\wlog{#1: #2}}\fi \expandafter\next\fi \ProvidesPackage{shellesc} - [2016/06/07 v0.02b unified shell escape interface for LaTeX] -\ifcase + [2019/10/17 v1.0b unified shell escape interface for LaTeX] +\chardef\shellesc@quotecat\catcode`\" +\chardef\shellesc@underscorecat\catcode`\_ +\@makeother\" +\@makeother\_ +\chardef\ShellEscapeStatus \ifx\pdfshellescape\@undefined \ifx\shellescape\@undefined \ifx\directlua\@undefined @@ -65,6 +69,7 @@ \else \pdfshellescape \fi +\ifcase\ShellEscapeStatus \PackageWarning{shellesc}{Shell escape disabled} \or \PackageInfo {shellesc}{Unrestricted shell escape enabled} @@ -74,16 +79,36 @@ \ifx\lastsavedimageresourcepages\@undefined \protected\def\ShellEscape{\immediate\write18 } \else - \protected\def\ShellEscape#1{% - \directlua{os.execute("\luaescapestring{#1}")}} + \protected\def\ShellEscape{\directlua\ShellEscape@Lua} \fi \ifx\lastsavedimageresourcepages\@undefined \protected\def\DelayedShellEscape{\relax\write18 } \else - \protected\def\DelayedShellEscape#1{% - \latelua{os.execute("\luaescapestring{#1}")}} + \protected\def\DelayedShellEscape{\latelua\ShellEscape@Lua} +\fi +\ifx\directlua\@undefined\else +\protected\def\ShellEscape@Lua#1{{% +local status, msg = os.execute("\luaescapestring{#1}")% +if status == nil then + texio.write_nl("log",% + "runsystem(" .. "\luaescapestring{#1}"% + .. ")...(" .. msg .. ")\string\n") + elseif status == 0 then + texio.write_nl("log",% + "runsystem(" .. "\luaescapestring{#1}"% + .. ")...executed\string\n") + else + texio.write_nl("log",% + "runsystem(" .. "\luaescapestring{#1}"% + .. ")...failed " .. (msg or "") .. "\string\n") + end +}} +\fi +\ifx\lastsavedimageresourcepages\@undefined + \catcode`\"\shellesc@quotecat + \catcode`\_\shellesc@underscorecat + \expandafter\endinput \fi -\ifx\lastsavedimageresourcepages\@undefined\expandafter\endinput\fi \directlua{% shellesc = shellesc or {} local function write_or_execute() @@ -100,6 +125,8 @@ shellesc.write_or_execute=write_or_execute } \let\shellesc@write\write \protected\def\write{\directlua{shellesc.write_or_execute()}} +\catcode`\"\shellesc@quotecat +\catcode`\"\shellesc@underscorecat \endinput %% %% End of file `shellesc.sty'. |