summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/iexec/iexec.pdfbin293865 -> 324986 bytes
-rw-r--r--Master/texmf-dist/source/latex/iexec/iexec.dtx182
-rw-r--r--Master/texmf-dist/tex/latex/iexec/iexec.sty74
3 files changed, 152 insertions, 104 deletions
diff --git a/Master/texmf-dist/doc/latex/iexec/iexec.pdf b/Master/texmf-dist/doc/latex/iexec/iexec.pdf
index 3b14fd32d0b..96f30b15822 100644
--- a/Master/texmf-dist/doc/latex/iexec/iexec.pdf
+++ b/Master/texmf-dist/doc/latex/iexec/iexec.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/iexec/iexec.dtx b/Master/texmf-dist/source/latex/iexec/iexec.dtx
index ff627551a57..bdcb5609c94 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-15 0.9.1 Inputable Shell Executions]
+[2022-10-21 0.10.1 Inputable Shell Executions]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[tt=false, type1=true]{libertine}
\usepackage{microtype}
+\usepackage[dtx]{docshots}
\usepackage{iexec}
\usepackage{href-ul}
\PageIndex
@@ -81,29 +82,16 @@
% This package helps you execute shell commands right from the
% document and then put their output to the document:
%
-% \begin{multicols}{2}
-% \setlength{\parskip}{0pt}
-% \small
-% \raggedcolumns
-%\iffalse
-%<*verb>
-%\fi
-\begin{verbatim}
-\documentclass{article}
-\usepackage{iexec}
-\begin{document}
-Today is
- \iexec{date +\%e-\%b-\%Y}
-\end{document}
-\end{verbatim}
-%\iffalse
-%</verb>
-%\fi
-%
-% \columnbreak
-%
-% Today is \iexec[log]{date +\%e-\%b-\%Y}
-% \end{multicols}
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage{iexec}
+% \usepackage[paperwidth=3in]{geometry}
+% \pagestyle{empty}
+% \begin{document}
+% Today is \textbf{%
+% \iexec{date +\%e-\%b-\%Y}}
+% \end{document}
+% \end{docshot}
% \DescribeMacro{\iexec} The only command provided by this package is |\iexec| \oarg{options} \marg{cmd}.
% Its only mandatory argument \meta{cmd} is the command to be executed
@@ -117,19 +105,16 @@ Today is
% \section{Options}
-% \DescribeMacro{quiet} If you don't want the output to be visible,
+% \DescribeMacro{quiet}
+% If you don't want the output to be visible,
% use |\phantom\{\iexec{...}}|.
% Otherwise, you can use |quiet| option:
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
-\documentclass{article}
-\usepackage{iexec}
-\begin{document}
I just want to delete some file:
\iexec[quiet]{rm -f foo.txt}
-\end{document}
\end{verbatim}
%\iffalse
%</verb>
@@ -137,41 +122,36 @@ I just want to delete some file:
% In this case, whatever the shell command produces will not be included
% into the document.
-% \DescribeMacro{stdout} The output of your code is saved into the file provided as an
+% \DescribeMacro{stdout}
+% The output of your code is saved into the file provided as an
% optional argument of |\iexec| (the default value is |iexec.tmp|):
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
-\documentclass{article}
-\usepackage{iexec}
-\begin{document}
Today is \iexec[stdout=date.txt]{date +\%e-\%b-\%Y | tr -d '\\n'}.
-\end{document}
\end{verbatim}
%\iffalse
%</verb>
%\fi
% The tailing part of the command here removes all ends-of-line.
-% \DescribeMacro{stderr} The error output of the code is saved into the file provided as an
+% \DescribeMacro{stderr}
+% The error output of the code is saved into the file provided as an
% optional argument of |\iexec| (by default the error output
% is streamed into |stdout|):
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
-\documentclass{article}
-\usepackage{iexec}
-\begin{document}
Today is \iexec[stderr=my.txt]{broken-command}.
-\end{document}
\end{verbatim}
%\iffalse
%</verb>
%\fi
-% \DescribeMacro{trace} The file specified will be deleted right after its usage. If you don't
+% \DescribeMacro{trace}
+% The file specified will be deleted right after its usage. If you don't
% want this to happen, use |trace| package option: all files will remain
% in the directory where they were created.
% It's possible to turn tracing on globbaly, for the entire document, using
@@ -190,7 +170,8 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
%</verb>
%\fi
-% \DescribeMacro{append} The stdout produced will be appended to the file specified:
+% \DescribeMacro{append}
+% The stdout produced will be appended to the file specified:
%\iffalse
%<*verb>
%\fi
@@ -207,31 +188,38 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
%</verb>
%\fi
-% \DescribeMacro{log} The stdout produced will be printed in \TeX{} log:
+% \DescribeMacro{log}
+% The stdout produced will be printed in \TeX{} log:
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
-\documentclass{article}
-\usepackage{iexec}
-\begin{document}
\iexec[log]{echo 'Hello, \\LaTeX!'}
-\end{document}
\end{verbatim}
%\iffalse
%</verb>
%\fi
-% \DescribeMacro{null} The stdout of the command will be sent to |/dev/null|:
+% \DescribeMacro{null}
+% The stdout of the command will be sent to |/dev/null|:
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
-\documentclass{article}
-\usepackage{iexec}
-\begin{document}
\iexec[null]{rm some-file.txt}
-\end{document}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+
+% \DescribeMacro{ignore}
+% By default, we report an error if exit code is not equal to zero. You can suppress
+% this with |ignore| option:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\iexec[ignore]{broken-command}
\end{verbatim}
%\iffalse
%</verb>
@@ -241,15 +229,6 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \section{Implementation}
-% \changes{v0.2.0}{2021/07/10}{Initial version}
-% \changes{v0.4.0}{2021/08/01}{Runtime verification for --shell-escape option}
-% \changes{v0.4.1}{2021/08/08}{Options trace, stdout, and quiet added}
-% \changes{v0.5.0}{2022/01/08}{Major bug fixes}
-% \changes{v0.6.0}{2022/10/09}{Additional options 'log' and 'append'}
-% \changes{v0.7.0}{2022/10/10}{Additional option 'null'}
-% \changes{v0.8.0}{2022/10/11}{Bug fixes}
-% \changes{v0.9.0}{2022/10/12}{Additional option 'stderr'}
-
% First, we include \href{https://ctan.org/pkg/shellesc}{shellesc} package, which
% we use to execute shell commands:
% \begin{macrocode}
@@ -267,6 +246,9 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \end{macrocode}
% Then, we prepare to parse the options of |\iexec| command:
+% \changes{v0.10.0}{2022/10/19}{The option "ignore" suppresses the checking of "iexec.ret" value.}
+% \changes{v0.7.0}{2022/09/25}{The option "append" was introduced --- if it's turned on, stdout will be appended to the file, instead of rewriting it (this is how it was before).}
+% \changes{v0.7.0}{2022/09/25}{The option "log" was introduced, to turn on log/debug messages in TeX log (they were all visible always, which was sometimes annoying. Also, this option enables printing of the entire content of stdout to the log too (this may be pretty convenient for debugging).}
% \begin{macrocode}
\RequirePackage{pgfkeys}
\makeatletter\pgfkeys{
@@ -280,6 +262,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
log/.store in = \iexec@log,
null/.store in = \iexec@null,
quiet/.store in = \iexec@quiet,
+ ignore/.store in = \iexec@ignore,
stdout
}\makeatother
% \end{macrocode}
@@ -307,9 +290,12 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \begin{macro}{\iexec}
% Then, we define |\iexec| command.
% It is implemented with the help of |\ShellEscape| from |shellesc| package:
+% \changes{v0.10.0}{2022/10/19}{The file "iexec.ret" is reused for all scripts.}
% \begin{macrocode}
-\makeatletter\newcommand\iexec[2][]{%
- \begingroup
+\makeatletter
+\newread\iexec@retfile
+\newcommand\iexec[2][]{%
+ \begingroup%
\pgfqkeys{/iexec}{#1}%
% \end{macrocode}
% First, we verify that |latex| is running with |--shell-escape| option, since without
@@ -323,7 +309,9 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \end{macrocode}
% Then, start the log from a clean line:
% \begin{macrocode}
- \message{^^J}%
+ \ifdefined\iexec@log%
+ \message{^^J}%
+ \fi%
% \end{macrocode}
% Then, we define a few special chars in order to escape them in the shell
% (the full
@@ -335,36 +323,60 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
\let\}\@charrb%
% \end{macrocode}
% Then, we execute it:
+% \changes{v0.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{v0.8.0}{2022/10/05}{The option "null" was introduced, allowing redirection of stdout to "/dev/null". Doesn't work on Windows, though.}
+% \changes{v0.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.}
% \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}
+ \space\ifdefined\iexec@stderr2>\iexec@stderr\else2>&1\fi
+ \ifdefined\iexec@ignore\else; echo $? >iexec.ret\fi}
\ShellEscape{\iexec@cmd}%
% \end{macrocode}
% Then, a message is printed to TeX log:
% \begin{macrocode}
- \message{iexec: [\iexec@cmd]^^J}%
+ \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:
% \begin{macrocode}
- \ifdefined\iexec@null\else
- \ifdefined\iexec@log
- \message{iexec: this is the content of \iexec@stdout:^^J}%
- \iexec@typeout{\iexec@stdout}
+ \ifdefined\iexec@null\else%
+ \ifdefined\iexec@log%
+ \message{iexec: This is the content of \iexec@stdout:^^J}%
+ \iexec@typeout{\iexec@stdout}%
\message{<EOF>^^J}%
\fi\fi%
% \end{macrocode}
+% Then, we check exit code:
+% \begin{macrocode}
+ \ifdefined\iexec@log\else%
+ \immediate\openin\iexec@retfile=iexec.ret%
+ \read\iexec@retfile to \iexec@ret%
+ \immediate\closein\iexec@retfile%
+ \ifnum\iexec@ret=0\else%
+ \PackageError{iexec}{Exit code is \iexec@ret}{}%
+ \fi%
+ \fi%
+% \end{macrocode}
% Then, include the produced output into the current document:
% \begin{macrocode}
- \ifdefined\iexec@null\else
- \ifdefined\iexec@quiet
- \message{iexec: Due to 'quiet' option we didn't read
- the content of '\iexec@stdout' (\pdffilesize{} bytes)^^J}%
+ \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%
- \message{iexec: We include the content of
- '\iexec@stdout' (\pdffilesize{} bytes)...^^J}%
+ \ifdefined\iexec@log%
+ \message{iexec: We include the content of
+ '\iexec@stdout'\ifdefined\pdffilesize(\pdffilesize
+ {\iexec@stdout} bytes)\fi...^^J}%
+ \fi%
\input{\iexec@stdout}%
\message{iexec: The content of '\iexec@stdout'
was included into the document^^J}%
@@ -372,17 +384,23 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \end{macrocode}
% Finally, delete the file or leave it untouched:
% \begin{macrocode}
- \ifdefined\iexec@null\else
+ \ifdefined\iexec@null\else%
\ifiexec@trace%
- \message{iexec: Due to package option 'trace',
- the file '\iexec@stdout' was not deleted^^J}%
+ \ifdefined\iexec@log%
+ \message{iexec: Due to package option 'trace',
+ the file '\iexec@stdout' was not deleted^^J}%
+ \fi%
\else%
\ifdefined\iexec@traceit%
- \message{iexec: Due to 'trace' option,
- the file '\iexec@stdout' was not deleted^^J}%
+ \ifdefined\iexec@log%
+ \message{iexec: Due to 'trace' option,
+ the file '\iexec@stdout' was not deleted^^J}%
+ \fi%
\else%
\ShellEscape{rm \iexec@stdout}%
- \message{iexec: The file '\iexec@stdout' was deleted^^J}%
+ \ifdefined\iexec@log%
+ \message{iexec: The file '\iexec@stdout' was deleted^^J}%
+ \fi%
\fi%
\fi\fi%
\endgroup
@@ -393,7 +411,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \Finale
%\clearpage
-%
%\PrintChanges
+
%\clearpage
%\PrintIndex
diff --git a/Master/texmf-dist/tex/latex/iexec/iexec.sty b/Master/texmf-dist/tex/latex/iexec/iexec.sty
index 4eca7db498a..401e8565c55 100644
--- a/Master/texmf-dist/tex/latex/iexec/iexec.sty
+++ b/Master/texmf-dist/tex/latex/iexec/iexec.sty
@@ -31,7 +31,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{iexec}
-[2022-10-15 0.9.1 Inputable Shell Executions]
+[2022-10-21 0.10.1 Inputable Shell Executions]
@@ -68,6 +68,7 @@
log/.store in = \iexec@log,
null/.store in = \iexec@null,
quiet/.store in = \iexec@quiet,
+ ignore/.store in = \iexec@ignore,
stdout
}\makeatother
@@ -85,15 +86,19 @@
}
\ExplSyntaxOff\makeatother
-\makeatletter\newcommand\iexec[2][]{%
- \begingroup
+\makeatletter
+\newread\iexec@retfile
+\newcommand\iexec[2][]{%
+ \begingroup%
\pgfqkeys{/iexec}{#1}%
\ifnum\ShellEscapeStatus=1\else%
\PackageError{iexec}{You must run TeX processor with
--shell-escape option}{}%
\fi%
\begingroup%
- \message{^^J}%
+ \ifdefined\iexec@log%
+ \message{^^J}%
+ \fi%
\let\%\@percentchar%
\let\\\@backslashchar%
\let\{\@charlb%
@@ -101,44 +106,69 @@
\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}
+ \space\ifdefined\iexec@stderr2>\iexec@stderr\else2>&1\fi
+ \ifdefined\iexec@ignore\else; echo $? >iexec.ret\fi}
\ShellEscape{\iexec@cmd}%
- \message{iexec: [\iexec@cmd]^^J}%
+ \ifdefined\iexec@log%
+ \message{iexec: [\iexec@cmd]^^J}%
+ \fi%
\endgroup%
- \ifdefined\iexec@null\else
- \ifdefined\iexec@log
- \message{iexec: this is the content of \iexec@stdout:^^J}%
- \iexec@typeout{\iexec@stdout}
+ \ifdefined\iexec@null\else%
+ \ifdefined\iexec@log%
+ \message{iexec: This is the content of \iexec@stdout:^^J}%
+ \iexec@typeout{\iexec@stdout}%
\message{<EOF>^^J}%
\fi\fi%
- \ifdefined\iexec@null\else
- \ifdefined\iexec@quiet
- \message{iexec: Due to 'quiet' option we didn't read
- the content of '\iexec@stdout' (\pdffilesize{} bytes)^^J}%
+ \ifdefined\iexec@log\else%
+ \immediate\openin\iexec@retfile=iexec.ret%
+ \read\iexec@retfile to \iexec@ret%
+ \immediate\closein\iexec@retfile%
+ \ifnum\iexec@ret=0\else%
+ \PackageError{iexec}{Exit code is \iexec@ret}{}%
+ \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%
- \message{iexec: We include the content of
- '\iexec@stdout' (\pdffilesize{} bytes)...^^J}%
+ \ifdefined\iexec@log%
+ \message{iexec: We include the content of
+ '\iexec@stdout'\ifdefined\pdffilesize(\pdffilesize
+ {\iexec@stdout} bytes)\fi...^^J}%
+ \fi%
\input{\iexec@stdout}%
\message{iexec: The content of '\iexec@stdout'
was included into the document^^J}%
\fi\fi%
- \ifdefined\iexec@null\else
+ \ifdefined\iexec@null\else%
\ifiexec@trace%
- \message{iexec: Due to package option 'trace',
- the file '\iexec@stdout' was not deleted^^J}%
+ \ifdefined\iexec@log%
+ \message{iexec: Due to package option 'trace',
+ the file '\iexec@stdout' was not deleted^^J}%
+ \fi%
\else%
\ifdefined\iexec@traceit%
- \message{iexec: Due to 'trace' option,
- the file '\iexec@stdout' was not deleted^^J}%
+ \ifdefined\iexec@log%
+ \message{iexec: Due to 'trace' option,
+ the file '\iexec@stdout' was not deleted^^J}%
+ \fi%
\else%
\ShellEscape{rm \iexec@stdout}%
- \message{iexec: The file '\iexec@stdout' was deleted^^J}%
+ \ifdefined\iexec@log%
+ \message{iexec: The file '\iexec@stdout' was deleted^^J}%
+ \fi%
\fi%
\fi\fi%
\endgroup
}\makeatother
+
\endinput
%%
%% End of file `iexec.sty'.