diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-23 20:36:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-23 20:36:54 +0000 |
commit | 3aaee7847c4dcd77ffe138c8121576f18c1394bd (patch) | |
tree | 9515c3682f6e755f944ed5ff26264ff2f165eb4e /Master/texmf-dist/source/latex/iexec | |
parent | 9d99b8df2e57361eb63fa8bb59f3c0491ffe1218 (diff) |
iexec (23oct22)
git-svn-id: svn://tug.org/texlive/trunk@64790 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/iexec')
-rw-r--r-- | Master/texmf-dist/source/latex/iexec/iexec.dtx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/Master/texmf-dist/source/latex/iexec/iexec.dtx b/Master/texmf-dist/source/latex/iexec/iexec.dtx index 30f44bdbf9a..94b924652a8 100644 --- a/Master/texmf-dist/source/latex/iexec/iexec.dtx +++ b/Master/texmf-dist/source/latex/iexec/iexec.dtx @@ -50,12 +50,13 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{iexec} %<*package> -[2022-10-22 0.11.0 Inputable Shell Executions] +[2022-10-23 0.11.1 Inputable Shell Executions] %</package> %<*driver> \documentclass{ltxdoc} \usepackage[tt=false, type1=true]{libertine} \usepackage{microtype} +\usepackage{xcolor} \usepackage[dtx]{docshots} \usepackage{iexec} \usepackage{href-ul} @@ -77,6 +78,9 @@ % % \maketitle % +% \textbf{\color{red}NB!} +% This package doesn't work on Windows! +% % \section{Introduction} % % This package helps you execute shell commands right from the @@ -324,7 +328,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}. \fi% \begingroup% % \end{macrocode} -% Then, start the log from a clean line: +% Then, we start the log from a clean line: % \begin{macrocode} \ifdefined\iexec@log% \message{^^J}% @@ -339,27 +343,28 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}. \let\{\@charlb% \let\}\@charrb% % \end{macrocode} -% Then, we execute it: +% Then, we execute it and save exit code into a file (where we also add \% in order to trim the content to exactly one number, as suggested \href{https://tex.stackexchange.com/questions/662756}{here}): % \changes{0.10.0}{2022/10/19}{The ability to track exit code was added. Now, the code is saved into "iexec.ret" file, which is then read and checked for zero value.} % \changes{0.8.0}{2022/10/05}{The option "null" was introduced, allowing redirection of stdout to "/dev/null". Doesn't work on Windows, though.} % \changes{0.9.0}{2022/10/15}{The option "stderr" was introduced, allowing redirection of stderr to a file. Without this option specified, stderr will go to stdout.} % \changes{0.11.0}{2022/10/22}{The file with exit code now contains just numbers, without end of line.} +% \changes{0.11.1}{2022/10/23}{When exit code is printed to the file, we add percentchar at the end of line in order to avoid extra space when reading it back.} % \begin{macrocode} \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 $? >\iexec@exit} + /bin/echo -n $?\% >\iexec@exit} \ShellEscape{\iexec@cmd}% % \end{macrocode} -% Then, a message is printed to TeX log: +% Then, a message is printed to \TeX{} log: % \begin{macrocode} \ifdefined\iexec@log% \message{iexec: [\iexec@cmd]^^J}% \fi% \endgroup% % \end{macrocode} -% Then, if required, the content of the stdout file will be printed to the log: +% Then, if required, we print the content of the stdout file to \TeX{} log: % \begin{macrocode} \ifdefined\iexec@null\else% \ifdefined\iexec@log% @@ -368,11 +373,14 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}. \message{<EOF>^^J}% \fi\fi% % \end{macrocode} -% Then, we check exit code, unless there is |ignore| option: +% Then, we read back the exit code, from the file: % \begin{macrocode} \immediate\openin\iexec@exitfile=\iexec@exit% \read\iexec@exitfile to \iexec@code% \immediate\closein\iexec@exitfile% +% \end{macrocode} +% Then, we check whether it's zero or not (if not zero, we either print a message or fail the build, depending on the presence of |ignore| option): +% \begin{macrocode} \ifnum\iexec@code=0\else% \ifdefined\iexec@ignore% \ifdefined\iexec@log% @@ -385,7 +393,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}. \fi% \fi% % \end{macrocode} -% Then, include the produced output into the current document: +% Then, we include the produced output into the current document: % \begin{macrocode} \ifdefined\iexec@null\else% \ifdefined\iexec@quiet% @@ -406,7 +414,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}. was included into the document^^J}% \fi\fi% % \end{macrocode} -% Finally, delete the file or leave it untouched: +% Finally, we delete the file or leave it untouched: % \begin{macrocode} \ifdefined\iexec@null\else% \ifiexec@trace% |