texlive[64697] Master/texmf-dist: iexec (13oct22)
commits+karl at tug.org
commits+karl at tug.org
Thu Oct 13 22:37:02 CEST 2022
Revision: 64697
http://tug.org/svn/texlive?view=revision&revision=64697
Author: karl
Date: 2022-10-13 22:37:01 +0200 (Thu, 13 Oct 2022)
Log Message:
-----------
iexec (13oct22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/iexec/iexec.pdf
trunk/Master/texmf-dist/source/latex/iexec/iexec.dtx
trunk/Master/texmf-dist/tex/latex/iexec/iexec.sty
Modified: trunk/Master/texmf-dist/doc/latex/iexec/iexec.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/iexec/iexec.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/iexec/iexec.dtx 2022-10-13 20:36:00 UTC (rev 64696)
+++ trunk/Master/texmf-dist/source/latex/iexec/iexec.dtx 2022-10-13 20:37:01 UTC (rev 64697)
@@ -50,7 +50,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{iexec}
%<*package>
-[2022-10-10 0.8.1 Inputable Shell Executions]
+[2022-10-12 0.9.0 Inputable Shell Executions]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -105,12 +105,11 @@
% Today is \iexec[log]{date +\%e-\%b-\%Y}
% \end{multicols}
-% \begin{macro}{\iexec}
+% \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
% through the terminal shell (bash, or whatever is set as the default one
% on your user console).
-% \end{macro}
% You have to run |pdflatex| (or just |latex|)
% with the |--shell-escape| flag
@@ -119,7 +118,7 @@
% \section{Options}
-% \begin{macro}{quiet}
+% \DescribeMacro{quiet}
% If you don't want the output to be visible,
% use |\phantom\{\iexec{...}}|.
% Otherwise, you can use |quiet| option:
@@ -137,13 +136,12 @@
%\iffalse
%</verb>
%\fi
-% \end{macro}
% In this case, whatever the shell command produces will not be included
% into the document.
-% \begin{macro}{stdout}
-% The output of your code is saved into the file provided as the
-% second optional argument of |\iexec| (the default value is |iexec.tmp|):
+% \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
@@ -158,9 +156,26 @@
%</verb>
%\fi
% The tailing part of the command here removes all ends-of-line.
-% \end{macro}
-% \begin{macro}{trace}
+% \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
% want this to happen, use |trace| package option: all files will remain
% in the directory where they were created.
@@ -179,9 +194,8 @@
%\iffalse
%</verb>
%\fi
-% \end{macro}
-% \begin{macro}{append}
+% \DescribeMacro{append}
% The stdout produced will be appended to the file specified:
%\iffalse
%<*verb>
@@ -198,9 +212,8 @@
%\iffalse
%</verb>
%\fi
-% \end{macro}
-% \begin{macro}{log}
+% \DescribeMacro{log}
% The stdout produced will be printed in \TeX{} log:
%\iffalse
%<*verb>
@@ -215,9 +228,8 @@
%\iffalse
%</verb>
%\fi
-% \end{macro}
-% \begin{macro}{null}
+% \DescribeMacro{null}
% The stdout of the command will be sent to |/dev/null|:
%\iffalse
%<*verb>
@@ -232,7 +244,6 @@
%\iffalse
%</verb>
%\fi
-% \end{macro}
% \StopEventually{}
@@ -244,6 +255,8 @@
% \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 a few packages:
% \begin{macrocode}
@@ -263,6 +276,7 @@
/iexec,
stdout/.estore in = \iexec at stdout,
stdout/.default = iexec.tmp,
+ stderr/.estore in = \iexec at stderr,
trace/.estore in = \iexec at traceit,
append/.estore in = \iexec at append,
log/.estore in = \iexec at log,
@@ -308,6 +322,10 @@
\fi\fi%
\begingroup%
% \end{macrocode}
+% Then, start the log from a clean line:
+% \begin{macrocode}
+ \message{^^J}%
+% \end{macrocode}
% Then, we define a few special chars in order to escape them in the shell
% (the full
% list of them is in \href{https://ctan.mirror.norbert-ruehl.de/info/macros2e/macros2e.pdf}{macros2e}):
@@ -319,11 +337,15 @@
% \end{macrocode}
% Then, we execute it:
% \begin{macrocode}
- \ShellEscape{#2 \ifdefined\iexec at append>\fi>\ifdefined\iexec at null/dev/null\else\iexec at stdout\fi}%
+ \def\iexec at cmd{(#2)
+ \ifdefined\iexec at append>\fi>
+ \ifdefined\iexec at null/dev/null\else\iexec at stdout\fi
+ \space\ifdefined\iexec at stderr2>\iexec at stderr\else2>&1\fi}
+ \ShellEscape{\iexec at cmd}%
% \end{macrocode}
% Then, a message is printed to TeX log:
% \begin{macrocode}
- \message{^^Jiexec: [#2 \ifdefined\iexec at append>\fi>\ifdefined\iexec at null/dev/null\else\iexec at stdout\fi]^^J}%
+ \message{iexec: [\iexec at cmd]^^J}%
\endgroup%
% \end{macrocode}
% Then, if required, the content of the stdout file will be printed to the log:
@@ -330,9 +352,9 @@
% \begin{macrocode}
\ifdefined\iexec at null\else
\ifdefined\iexec at log
- \message{^^Jiexec: this is the content of \iexec at stdout:^^J}%
+ \message{iexec: this is the content of \iexec at stdout:^^J}%
\iexec at typeout{\iexec at stdout}
- \message{^^J<EOF>^^J}%
+ \message{<EOF>^^J}%
\fi\fi%
% \end{macrocode}
% Then, include the produced output into the current document:
@@ -339,13 +361,13 @@
% \begin{macrocode}
\ifdefined\iexec at null\else
\ifdefined\iexec at quiet
- \message{^^Jiexec: Due to 'quiet' option we didn't read
+ \message{iexec: Due to 'quiet' option we didn't read
the content of '\iexec at stdout' (\pdffilesize{} bytes)^^J}%
\else%
- \message{^^Jiexec: We include the content of
+ \message{iexec: We include the content of
'\iexec at stdout' (\pdffilesize{} bytes)...^^J}%
\input{\iexec at stdout}%
- \message{^^Jiexec: The content of '\iexec at stdout'
+ \message{iexec: The content of '\iexec at stdout'
was included into the document^^J}%
\fi\fi%
% \end{macrocode}
@@ -353,15 +375,15 @@
% \begin{macrocode}
\ifdefined\iexec at null\else
\ifiexec at trace%
- \message{^^Jiexec: Due to package option 'trace',
+ \message{iexec: Due to package option 'trace',
the file '\iexec at stdout' was not deleted^^J}%
\else%
\ifdefined\iexec at traceit%
- \message{^^Jiexec: Due to 'trace' option,
+ \message{iexec: Due to 'trace' option,
the file '\iexec at stdout' was not deleted^^J}%
\else%
\ShellEscape{rm \iexec at stdout}%
- \message{^^Jiexec: The file '\iexec at stdout' was deleted^^J}%
+ \message{iexec: The file '\iexec at stdout' was deleted^^J}%
\fi%
\fi\fi%
\endgroup
Modified: trunk/Master/texmf-dist/tex/latex/iexec/iexec.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/iexec/iexec.sty 2022-10-13 20:36:00 UTC (rev 64696)
+++ trunk/Master/texmf-dist/tex/latex/iexec/iexec.sty 2022-10-13 20:37:01 UTC (rev 64697)
@@ -31,7 +31,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{iexec}
-[2022-10-10 0.8.1 Inputable Shell Executions]
+[2022-10-12 0.9.0 Inputable Shell Executions]
@@ -46,6 +46,7 @@
+
\RequirePackage{shellesc}
\RequirePackage{pgfkeys}
\RequirePackage{expl3}
@@ -59,6 +60,7 @@
/iexec,
stdout/.estore in = \iexec at stdout,
stdout/.default = iexec.tmp,
+ stderr/.estore in = \iexec at stderr,
trace/.estore in = \iexec at traceit,
append/.estore in = \iexec at append,
log/.estore in = \iexec at log,
@@ -88,41 +90,46 @@
--shell-escape option}{}%
\fi\fi%
\begingroup%
+ \message{^^J}%
\let\%\@percentchar%
\let\\\@backslashchar%
\let\{\@charlb%
\let\}\@charrb%
- \ShellEscape{#2 \ifdefined\iexec at append>\fi>\ifdefined\iexec at null/dev/null\else\iexec at stdout\fi}%
- \message{^^Jiexec: [#2 \ifdefined\iexec at append>\fi>\ifdefined\iexec at null/dev/null\else\iexec at stdout\fi]^^J}%
+ \def\iexec at cmd{(#2)
+ \ifdefined\iexec at append>\fi>
+ \ifdefined\iexec at null/dev/null\else\iexec at stdout\fi
+ \space\ifdefined\iexec at stderr2>\iexec at stderr\else2>&1\fi}
+ \ShellEscape{\iexec at cmd}%
+ \message{iexec: [\iexec at cmd]^^J}%
\endgroup%
\ifdefined\iexec at null\else
\ifdefined\iexec at log
- \message{^^Jiexec: this is the content of \iexec at stdout:^^J}%
+ \message{iexec: this is the content of \iexec at stdout:^^J}%
\iexec at typeout{\iexec at stdout}
- \message{^^J<EOF>^^J}%
+ \message{<EOF>^^J}%
\fi\fi%
\ifdefined\iexec at null\else
\ifdefined\iexec at quiet
- \message{^^Jiexec: Due to 'quiet' option we didn't read
+ \message{iexec: Due to 'quiet' option we didn't read
the content of '\iexec at stdout' (\pdffilesize{} bytes)^^J}%
\else%
- \message{^^Jiexec: We include the content of
+ \message{iexec: We include the content of
'\iexec at stdout' (\pdffilesize{} bytes)...^^J}%
\input{\iexec at stdout}%
- \message{^^Jiexec: The content of '\iexec at stdout'
+ \message{iexec: The content of '\iexec at stdout'
was included into the document^^J}%
\fi\fi%
\ifdefined\iexec at null\else
\ifiexec at trace%
- \message{^^Jiexec: Due to package option 'trace',
+ \message{iexec: Due to package option 'trace',
the file '\iexec at stdout' was not deleted^^J}%
\else%
\ifdefined\iexec at traceit%
- \message{^^Jiexec: Due to 'trace' option,
+ \message{iexec: Due to 'trace' option,
the file '\iexec at stdout' was not deleted^^J}%
\else%
\ShellEscape{rm \iexec at stdout}%
- \message{^^Jiexec: The file '\iexec at stdout' was deleted^^J}%
+ \message{iexec: The file '\iexec at stdout' was deleted^^J}%
\fi%
\fi\fi%
\endgroup
More information about the tex-live-commits
mailing list.