[latex3-commits] [git/LaTeX3-latex3-l3build] master: Avoid temporary file when passing "y" in unpack (633418d)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Feb 21 09:15:58 CET 2020


Repository : https://github.com/latex3/l3build
On branch  : master
Link       : https://github.com/latex3/l3build/commit/633418d5122f10b5e8ef75c87d8d1c044a594a0c

>---------------------------------------------------------------

commit 633418d5122f10b5e8ef75c87d8d1c044a594a0c
Author: Marcel Fabian Krüger <zauguin at gmail.com>
Date:   Sun Feb 9 02:08:58 2020 +0100

    Avoid temporary file when passing "y" in unpack


>---------------------------------------------------------------

633418d5122f10b5e8ef75c87d8d1c044a594a0c
 l3build-unpack.lua | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/l3build-unpack.lua b/l3build-unpack.lua
index 47aaca7..5eed747 100644
--- a/l3build-unpack.lua
+++ b/l3build-unpack.lua
@@ -73,26 +73,20 @@ bundleunpack = bundleunpack or function(sourcedirs, sources)
   end
   for _,i in ipairs(unpackfiles) do
     for j,_ in pairs(tree(unpackdir, i)) do
-      -- This 'yes' business is needed to pass a series of "y\n" to
-      -- TeX if \askforoverwrite is true
-      -- That is all done using a file as it's the only way on Windows and
-      -- on Unix the "yes" command can't be used inside execute (it never
-      -- stops, which confuses Lua)
-      execute(os_yes .. ">>" .. localdir .. "/yes")
       local path, name = splitpath(j)
       local localdir = abspath(localdir)
-      errorlevel = run(
-        unpackdir .. "/" .. path,
+      errorlevel = io.popen(
+        "cd " .. unpackdir .. "/" .. path .. os_concat ..
         os_setenv .. " TEXINPUTS=." .. os_pathsep
           .. localdir .. (unpacksearch and os_pathsep or "") ..
         os_concat  ..
         os_setenv .. " LUAINPUTS=." .. os_pathsep
           .. localdir .. (unpacksearch and os_pathsep or "") ..
         os_concat ..
-        unpackexe .. " " .. unpackopts .. " " .. name .. " < "
-          .. localdir .. "/yes"
-          .. (options["quiet"] and (" > " .. os_null) or "")
-      )
+        unpackexe .. " " .. unpackopts .. " " .. name
+          .. (options["quiet"] and (" > " .. os_null) or ""),
+        "w"
+      ):write(string.rep("y\n", 300)):close()
       if errorlevel ~=0 then
         return errorlevel
       end





More information about the latex3-commits mailing list.