[latex3-commits] [l3svn] 02/02: l3build: New approach to iterating over lines

noreply at latex-project.org noreply at latex-project.org
Fri Mar 31 10:31:37 CEST 2017


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

commit 7616df1593b55adc49fdc1540606789cb14233c8
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Mar 31 09:30:43 2017 +0100

    l3build: New approach to iterating over lines
    
    This allows for changes in LuaTeX from v1.04 and keeps almost all
    .tlg files unchanged. Some adjustments in the 2e suite may follow.
---
 l3build/l3build.lua |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/l3build/l3build.lua b/l3build/l3build.lua
index 667bbcf..e640aff 100644
--- a/l3build/l3build.lua
+++ b/l3build/l3build.lua
@@ -871,7 +871,11 @@ function formatlog(logfile, newfile, engine)
   local newlog = ""
   local prestart = true
   local skipping = false
-  for line in io.lines(logfile) do
+  -- Read the entire log file as a binary: deals with ^@/^[, etc.
+  local file = assert(io.open(logfile, "rb"))
+  local contents = file:read("*all") .. os_newline
+  io.close(file)
+  for line in string.gmatch(contents, "([^\r\n]*)[" .. os_newline .."]") do
     if line == "START-TEST-LOG" then
       prestart = false
     elseif line == "END-TEST-LOG" then
@@ -1064,7 +1068,11 @@ function formatlualog(logfile, newfile)
   local newlog = ""
   local lastline = ""
   local dropping = false
-  for line in io.lines(logfile) do
+  -- Read the entire log file as a binary: deals with ^@/^[, etc.
+  local file = assert(io.open(logfile, "rb"))
+  local contents = file:read("*all") .. os_newline
+  io.close(file)
+  for line in string.gmatch(contents, "([^\r\n]*)[" .. os_newline .."]") do
     line, lastline, dropping = normalize(line, lastline, dropping)
     if not string.match(line, "^ *$") then
       newlog = newlog .. line .. os_newline

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list