texlive[64779] Master/texmf-dist: iexec (22oct22)

commits+karl at tug.org commits+karl at tug.org
Sat Oct 22 22:19:19 CEST 2022


Revision: 64779
          http://tug.org/svn/texlive?view=revision&revision=64779
Author:   karl
Date:     2022-10-22 22:19:19 +0200 (Sat, 22 Oct 2022)
Log Message:
-----------
iexec (22oct22)

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-22 20:19:07 UTC (rev 64778)
+++ trunk/Master/texmf-dist/source/latex/iexec/iexec.dtx	2022-10-22 20:19:19 UTC (rev 64779)
@@ -50,7 +50,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{iexec}
 %<*package>
-[2022-10-21 0.10.1 Inputable Shell Executions]
+[2022-10-22 0.11.0 Inputable Shell Executions]
 %</package>
 %<*driver>
 \documentclass{ltxdoc}
@@ -93,15 +93,16 @@
 % \end{document}
 % \end{docshot}
 
-% \DescribeMacro{\iexec} The only command provided by this package is |\iexec| \oarg{options} \marg{cmd}.
+% \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).
+% through the terminal shell (|bash|, or whatever is set as the default one
+% in your console).
 
 % You have to run |pdflatex| (or just |latex|)
 % with the |--shell-escape| flag
-% in order to let |shellesc| (the package we use)
-% to execute your shell command.
+% in order to let \href{https://ctan.org/pkg/shellesc}{shellesc}
+% execute your shell command.
 
 % \section{Options}
 
@@ -150,6 +151,19 @@
 %</verb>
 %\fi
 
+% \DescribeMacro{exit}
+% The exit code of the command it saved into a file. You can change the name of it
+% using |exit| option:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+Today is \iexec[exit=code.txt]{./broken-command.sh}.
+\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
@@ -246,14 +260,17 @@
 %    \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).}
+% \changes{0.10.0}{2022/10/19}{The option "ignore" suppresses the checking of "iexec.ret" value.}
+% \changes{0.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{0.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).}
+% \changes{0.11.0}{2022/10/22}{The option "exit" allows to change the name of the file with exit code.}
 %    \begin{macrocode}
 \RequirePackage{pgfkeys}
 \makeatletter\pgfkeys{
   /iexec/.is family,
   /iexec,
+  exit/.store in = \iexec at exit,
+  exit/.default = iexec.ret,
   stdout/.store in = \iexec at stdout,
   stdout/.default = iexec.tmp,
   stderr/.store in = \iexec at stderr,
@@ -263,7 +280,7 @@
   null/.store in = \iexec at null,
   quiet/.store in = \iexec at quiet,
   ignore/.store in = \iexec at ignore,
-  stdout
+  stdout,exit
 }\makeatother
 %    \end{macrocode}
 
@@ -290,10 +307,10 @@
 % \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.}
+% \changes{0.10.0}{2022/10/19}{The file "iexec.ret" is reused for all scripts.}
 %    \begin{macrocode}
 \makeatletter
-\newread\iexec at retfile
+\newread\iexec at exitfile
 \newcommand\iexec[2][]{%
   \begingroup%
     \pgfqkeys{/iexec}{#1}%
@@ -323,15 +340,16 @@
       \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.}
+% \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.}
 %    \begin{macrocode}
       \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
-        \ifdefined\iexec at ignore\else; echo $? >iexec.ret\fi}
+        \space\ifdefined\iexec at stderr2>\iexec at stderr\else2>&1\fi;
+        /bin/echo -n $? >\iexec at exit}
       \ShellEscape{\iexec at cmd}%
 %    \end{macrocode}
 % Then, a message is printed to TeX log:
@@ -350,14 +368,20 @@
       \message{<EOF>^^J}%
     \fi\fi%
 %    \end{macrocode}
-% Then, we check exit code:
+% Then, we check exit code, unless there is |ignore| option:
 %    \begin{macrocode}
-    \ifdefined\iexec at log\else%
-      \immediate\openin\iexec at retfile=iexec.ret%
-      \read\iexec at retfile to \iexec at ret%
-      \immediate\closein\iexec at retfile%
-      \ifnum\iexec at ret=0\else%
-        \PackageError{iexec}{Exit code is \iexec at ret}{}%
+    \immediate\openin\iexec at exitfile=\iexec at exit%
+    \read\iexec at exitfile to \iexec at code%
+    \immediate\closein\iexec at exitfile%
+    \ifnum\iexec at code=0\else%
+      \ifdefined\iexec at ignore%
+        \ifdefined\iexec at log%
+          \message{iexec: Execution failure ignored,
+            the exit code was \iexec at code^^J}%
+        \fi%
+      \else%
+        \PackageError{iexec}{Execution failure,
+          the exit code was \iexec at code}{}%
       \fi%
     \fi%
 %    \end{macrocode}
@@ -368,13 +392,13 @@
       \ifdefined\iexec at log%
         \message{iexec: Due to 'quiet' option we didn't read
         the content of '\iexec at stdout'
-        \ifdefined\pdffilesize(\pdffilesize{\iexec at stdout}
+        \ifdefined\pdffilesize (\pdffilesize{\iexec at stdout}
         bytes)\fi^^J}%
       \fi%
     \else%
       \ifdefined\iexec at log%
-        \message{iexec: We include the content of
-        '\iexec at stdout'\ifdefined\pdffilesize(\pdffilesize
+        \message{iexec: We are going to include the content of
+        '\iexec at stdout'\ifdefined\pdffilesize (\pdffilesize
         {\iexec at stdout} bytes)\fi...^^J}%
       \fi%
       \input{\iexec at stdout}%
@@ -388,13 +412,15 @@
     \ifiexec at trace%
       \ifdefined\iexec at log%
         \message{iexec: Due to package option 'trace',
-        the file '\iexec at stdout' was not deleted^^J}%
+        the files '\iexec at stdout' and `\iexec at exit` were
+        not deleted^^J}%
       \fi%
     \else%
       \ifdefined\iexec at traceit%
         \ifdefined\iexec at log%
-          \message{iexec: Due to 'trace' option,
-          the file '\iexec at stdout' was not deleted^^J}%
+          \message{iexec: Due to 'trace' package option,
+          the files '\iexec at stdout' and '\iexec at exit'
+          were not deleted^^J}%
         \fi%
       \else%
         \ShellEscape{rm \iexec at stdout}%
@@ -401,6 +427,10 @@
         \ifdefined\iexec at log%
           \message{iexec: The file '\iexec at stdout' was deleted^^J}%
         \fi%
+        \ShellEscape{rm \iexec at exit}%
+        \ifdefined\iexec at log%
+          \message{iexec: The file '\iexec at exit' was deleted^^J}%
+        \fi%
       \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-22 20:19:07 UTC (rev 64778)
+++ trunk/Master/texmf-dist/tex/latex/iexec/iexec.sty	2022-10-22 20:19:19 UTC (rev 64779)
@@ -31,7 +31,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{iexec}
-[2022-10-21 0.10.1 Inputable Shell Executions]
+[2022-10-22 0.11.0 Inputable Shell Executions]
 
 
 
@@ -47,6 +47,7 @@
 
 
 
+
 \RequirePackage{shellesc}
 
 \RequirePackage{xkeyval}
@@ -60,6 +61,8 @@
 \makeatletter\pgfkeys{
   /iexec/.is family,
   /iexec,
+  exit/.store in = \iexec at exit,
+  exit/.default = iexec.ret,
   stdout/.store in = \iexec at stdout,
   stdout/.default = iexec.tmp,
   stderr/.store in = \iexec at stderr,
@@ -69,7 +72,7 @@
   null/.store in = \iexec at null,
   quiet/.store in = \iexec at quiet,
   ignore/.store in = \iexec at ignore,
-  stdout
+  stdout,exit
 }\makeatother
 
 \RequirePackage{expl3}
@@ -87,7 +90,7 @@
 \ExplSyntaxOff\makeatother
 
 \makeatletter
-\newread\iexec at retfile
+\newread\iexec at exitfile
 \newcommand\iexec[2][]{%
   \begingroup%
     \pgfqkeys{/iexec}{#1}%
@@ -106,8 +109,8 @@
       \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
-        \ifdefined\iexec at ignore\else; echo $? >iexec.ret\fi}
+        \space\ifdefined\iexec at stderr2>\iexec at stderr\else2>&1\fi;
+        /bin/echo -n $? >\iexec at exit}
       \ShellEscape{\iexec at cmd}%
       \ifdefined\iexec at log%
         \message{iexec: [\iexec at cmd]^^J}%
@@ -119,12 +122,18 @@
       \iexec at typeout{\iexec at stdout}%
       \message{<EOF>^^J}%
     \fi\fi%
-    \ifdefined\iexec at log\else%
-      \immediate\openin\iexec at retfile=iexec.ret%
-      \read\iexec at retfile to \iexec at ret%
-      \immediate\closein\iexec at retfile%
-      \ifnum\iexec at ret=0\else%
-        \PackageError{iexec}{Exit code is \iexec at ret}{}%
+    \immediate\openin\iexec at exitfile=\iexec at exit%
+    \read\iexec at exitfile to \iexec at code%
+    \immediate\closein\iexec at exitfile%
+    \ifnum\iexec at code=0\else%
+      \ifdefined\iexec at ignore%
+        \ifdefined\iexec at log%
+          \message{iexec: Execution failure ignored,
+            the exit code was \iexec at code^^J}%
+        \fi%
+      \else%
+        \PackageError{iexec}{Execution failure,
+          the exit code was \iexec at code}{}%
       \fi%
     \fi%
     \ifdefined\iexec at null\else%
@@ -132,13 +141,13 @@
       \ifdefined\iexec at log%
         \message{iexec: Due to 'quiet' option we didn't read
         the content of '\iexec at stdout'
-        \ifdefined\pdffilesize(\pdffilesize{\iexec at stdout}
+        \ifdefined\pdffilesize (\pdffilesize{\iexec at stdout}
         bytes)\fi^^J}%
       \fi%
     \else%
       \ifdefined\iexec at log%
-        \message{iexec: We include the content of
-        '\iexec at stdout'\ifdefined\pdffilesize(\pdffilesize
+        \message{iexec: We are going to include the content of
+        '\iexec at stdout'\ifdefined\pdffilesize (\pdffilesize
         {\iexec at stdout} bytes)\fi...^^J}%
       \fi%
       \input{\iexec at stdout}%
@@ -149,13 +158,15 @@
     \ifiexec at trace%
       \ifdefined\iexec at log%
         \message{iexec: Due to package option 'trace',
-        the file '\iexec at stdout' was not deleted^^J}%
+        the files '\iexec at stdout' and `\iexec at exit` were
+        not deleted^^J}%
       \fi%
     \else%
       \ifdefined\iexec at traceit%
         \ifdefined\iexec at log%
-          \message{iexec: Due to 'trace' option,
-          the file '\iexec at stdout' was not deleted^^J}%
+          \message{iexec: Due to 'trace' package option,
+          the files '\iexec at stdout' and '\iexec at exit'
+          were not deleted^^J}%
         \fi%
       \else%
         \ShellEscape{rm \iexec at stdout}%
@@ -162,6 +173,10 @@
         \ifdefined\iexec at log%
           \message{iexec: The file '\iexec at stdout' was deleted^^J}%
         \fi%
+        \ShellEscape{rm \iexec at exit}%
+        \ifdefined\iexec at log%
+          \message{iexec: The file '\iexec at exit' was deleted^^J}%
+        \fi%
       \fi%
     \fi\fi%
   \endgroup



More information about the tex-live-commits mailing list.