diff options
author | Karl Berry <karl@freefriends.org> | 2024-01-14 21:14:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-01-14 21:14:04 +0000 |
commit | dd7d4fb7b0f8272e4f85ef551c57ebcd9b394704 (patch) | |
tree | 2ca8fdfe46041eba006f733845e07e71cd520b81 /Master/texmf-dist/tex/latex/iexec | |
parent | fbc4c1c8211c8117aaf0672ada4998b035de1cb3 (diff) |
iexec (14jan24)
git-svn-id: svn://tug.org/texlive/trunk@69419 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/iexec')
-rw-r--r-- | Master/texmf-dist/tex/latex/iexec/iexec.sty | 200 |
1 files changed, 104 insertions, 96 deletions
diff --git a/Master/texmf-dist/tex/latex/iexec/iexec.sty b/Master/texmf-dist/tex/latex/iexec/iexec.sty index aba99a820de..00036d6feca 100644 --- a/Master/texmf-dist/tex/latex/iexec/iexec.sty +++ b/Master/texmf-dist/tex/latex/iexec/iexec.sty @@ -7,7 +7,7 @@ %% iexec.dtx (with options: `package') %% (The MIT License) %% -%% Copyright (c) 2021-2023 Yegor Bugayenko +%% Copyright (c) 2021-2024 Yegor Bugayenko %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the 'Software'), to deal @@ -31,7 +31,8 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{iexec} -[2023-12-28 0.13.0 Inputable Shell Executions] +[2024-01-14 0.14.0 Inputable Shell Executions] + @@ -52,12 +53,12 @@ \RequirePackage{shellesc} -\RequirePackage{xkeyval} -\makeatletter -\newif\ifiexec@trace -\DeclareOptionX{trace}{\iexec@tracetrue} -\ProcessOptionsX\relax -\makeatother +\RequirePackage{pgfopts} +\pgfkeys{ + /iexec/.cd, + trace/.store in=\iexec@trace, +} +\ProcessPgfPackageOptions{/iexec} \RequirePackage{pgfkeys} \makeatletter\pgfkeys{ @@ -75,6 +76,7 @@ unskip/.store in = \iexec@unskip, quiet/.store in = \iexec@quiet, ignore/.store in = \iexec@ignore, + maybe/.store in = \iexec@maybe, stdout,exit }\makeatother @@ -97,111 +99,117 @@ \newcommand\iexec[2][]{% \begingroup% \pgfqkeys{/iexec}{#1}% - \ifnum\ShellEscapeStatus=1\else% - \PackageError{iexec}{You must run TeX processor with - --shell-escape option}{}% - \fi% - \begingroup% - \ifdefined\iexec@log% - \message{^^J}% - \fi% - \let\%\@percentchar% - \let\\\@backslashchar% - \let\{\@charlb% - \let\}\@charrb% - \def\iexec@cmd{(#2) - \ifdefined\iexec@append>\fi> - \ifdefined\iexec@null/dev/null\else\iexec@stdout\fi - \space\ifdefined\iexec@stderr2>\iexec@stderr\else2>&1\fi; - /bin/echo -n \string$?\% >\iexec@exit}% - \ShellEscape{\iexec@cmd}% - \ifdefined\iexec@log% - \message{iexec: [\iexec@cmd]^^J}% - \fi% - \endgroup% - \immediate\openin\iexec@exitfile=\iexec@exit% - \read\iexec@exitfile to \iexec@code% - \immediate\closein\iexec@exitfile% - \ifdefined\iexec@null\else% - \IfFileExists - {\iexec@stdout} - {} - {\PackageError{iexec}{The "\iexec@stdout" file is absent - after processing, looks like some internal error}{}}% - \ifdefined\iexec@log% - \message{iexec: This is the content of '\iexec@stdout':^^J}% + \ifnum\ShellEscapeStatus=1% + \begingroup% + \ifdefined\iexec@log% + \message{^^J}% + \fi% + \let\%\@percentchar% + \let\\\@backslashchar% + \let\{\@charlb% + \let\}\@charrb% + \def\iexec@cmd{(#2) + \ifdefined\iexec@append>\fi> + \ifdefined\iexec@null/dev/null\else\iexec@stdout\fi + \space\ifdefined\iexec@stderr2>\iexec@stderr\else2>&1\fi; + /bin/echo -n \string$?\% >\iexec@exit}% + \ShellEscape{\iexec@cmd}% + \ifdefined\iexec@log% + \message{iexec: [\iexec@cmd]^^J}% + \fi% + \endgroup% + \immediate\openin\iexec@exitfile=\iexec@exit% + \read\iexec@exitfile to \iexec@code% + \immediate\closein\iexec@exitfile% + \ifdefined\iexec@null\else% \IfFileExists {\iexec@stdout} - {\iexec@typeout{\iexec@stdout}} + {} {\PackageError{iexec}{The "\iexec@stdout" file is absent after processing, looks like some internal error}{}}% - \message{<EOF>^^J}% - \else% - \ifnum\iexec@code=0\else% - \ifdefined\iexec@ignore\else% - \message{iexec: See the content of '\iexec@stdout' - after failure:^^J}% - \iexec@typeout{\iexec@stdout}% - \message{<EOF>^^J}% + \ifdefined\iexec@log% + \message{iexec: This is the content of '\iexec@stdout':^^J}% + \IfFileExists + {\iexec@stdout} + {\iexec@typeout{\iexec@stdout}} + {\PackageError{iexec}{The "\iexec@stdout" file is absent + after processing, looks like some internal error}{}}% + \message{<EOF>^^J}% + \else% + \ifnum\iexec@code=0\else% + \ifdefined\iexec@ignore\else% + \message{iexec: See the content of '\iexec@stdout' + after failure:^^J}% + \iexec@typeout{\iexec@stdout}% + \message{<EOF>^^J}% + \fi% \fi% \fi% \fi% - \fi% - \ifnum\iexec@code=0\else% - \ifdefined\iexec@ignore% - \ifdefined\iexec@log% - \message{iexec: Execution failure ignored, - the exit code was \iexec@code^^J}% + \ifnum\iexec@code=0\else% + \ifdefined\iexec@ignore% + \ifdefined\iexec@log% + \message{iexec: Execution failure ignored, + the exit code was \iexec@code^^J}% + \fi% + \else% + \PackageError{iexec}{Execution failure, + the exit code was \iexec@code}{}% \fi% - \else% - \PackageError{iexec}{Execution failure, - the exit code was \iexec@code}{}% - \fi% - \fi% - \ifdefined\iexec@null\else% - \ifdefined\iexec@quiet% - \ifdefined\iexec@log% - \message{iexec: Due to 'quiet' option we didn't read - the content of '\iexec@stdout' - \ifdefined\pdffilesize (\pdffilesize{\iexec@stdout} - bytes)\fi^^J}% - \fi% - \else% - \ifdefined\iexec@log% - \message{iexec: We are going to include the content of - '\iexec@stdout'\ifdefined\pdffilesize (\pdffilesize - {\iexec@stdout} bytes)\fi...^^J}% - \fi% - \input{\iexec@stdout}% - \ifdefined\iexec@unskip\unskip\fi% - \message{iexec: The content of '\iexec@stdout' - was included into the document^^J}% - \fi\fi% - \ifdefined\iexec@null\else% - \ifiexec@trace% - \ifdefined\iexec@log% - \message{iexec: Due to package option 'trace', - the files '\iexec@stdout' and `\iexec@exit` were - not deleted^^J}% \fi% - \else% - \ifdefined\iexec@traceit% + \ifdefined\iexec@null\else% + \ifdefined\iexec@quiet% \ifdefined\iexec@log% - \message{iexec: Due to 'trace' package option, - the files '\iexec@stdout' and '\iexec@exit' - were not deleted^^J}% + \message{iexec: Due to 'quiet' option we didn't read + the content of '\iexec@stdout' + \ifdefined\pdffilesize (\pdffilesize{\iexec@stdout} + bytes)\fi^^J}% \fi% \else% - \ShellEscape{rm \iexec@stdout}% \ifdefined\iexec@log% - \message{iexec: The file '\iexec@stdout' was deleted^^J}% + \message{iexec: We are going to include the content of + '\iexec@stdout'\ifdefined\pdffilesize (\pdffilesize + {\iexec@stdout} bytes)\fi...^^J}% \fi% - \ShellEscape{rm \iexec@exit}% + \input{\iexec@stdout}% + \ifdefined\iexec@unskip\unskip\fi% + \message{iexec: The content of '\iexec@stdout' + was included into the document^^J}% + \fi\fi% + \ifdefined\iexec@null\else% + \ifdefined\iexec@trace% \ifdefined\iexec@log% - \message{iexec: The file '\iexec@exit' was deleted^^J}% + \message{iexec: Due to package option 'trace', + the files '\iexec@stdout' and `\iexec@exit` were + not deleted^^J}% \fi% + \else% + \ifdefined\iexec@traceit% + \ifdefined\iexec@log% + \message{iexec: Due to 'trace' package option, + the files '\iexec@stdout' and '\iexec@exit' + were not deleted^^J}% + \fi% + \else% + \ShellEscape{rm \iexec@stdout}% + \ifdefined\iexec@log% + \message{iexec: The file '\iexec@stdout' was deleted^^J}% + \fi% + \ShellEscape{rm \iexec@exit}% + \ifdefined\iexec@log% + \message{iexec: The file '\iexec@exit' was deleted^^J}% + \fi% + \fi% + \fi\fi% + \else% + \ifdefined\iexec@maybe% + \message{iexec: The execution skipped because -shell-escape + is not set and 'maybe' option is provided^^J}% + \else% + \PackageError{iexec}{You must run TeX processor with + --shell-escape option}{}% \fi% - \fi\fi% + \fi% \endgroup% }\makeatother |