[latex3-commits] [l3svn] branch master updated: l3build: Normalise line ends on reading

noreply at latex-project.org noreply at latex-project.org
Fri Mar 31 12:42:41 CEST 2017


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

joseph pushed a commit to branch master
in repository l3svn.

The following commit(s) were added to refs/heads/master by this push:
       new  12b31df   l3build: Normalise line ends on reading
12b31df is described below

commit 12b31df33839299e2f02132b75d79822e73a94ca
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Mar 31 11:41:53 2017 +0100

    l3build: Normalise line ends on reading
    
    For writing we need \r\n on Windows (up to LuaTeX v1.03), but for
    reading it is more sensible to normalise then have a simple loop.
---
 l3build/l3build.lua |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/l3build/l3build.lua b/l3build/l3build.lua
index a0169cd..a65576f 100644
--- a/l3build/l3build.lua
+++ b/l3build/l3build.lua
@@ -873,9 +873,9 @@ function formatlog(logfile, newfile, engine)
   local skipping = false
   -- 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
+  local contents = string.gsub(file:read("*all") .. "\n", "\r\n", "\n")
   io.close(file)
-  for line in string.gmatch(contents, "([^\r\n]*)" .. os_newline) do
+  for line in string.gmatch(contents, "([^\n]*)\n") do
     if line == "START-TEST-LOG" then
       prestart = false
     elseif line == "END-TEST-LOG" then
@@ -1070,9 +1070,9 @@ function formatlualog(logfile, newfile)
   local dropping = false
   -- 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
+  local contents = string.gsub(file:read("*all") .. "\n", "\r\n", "\n")
   io.close(file)
-  for line in string.gmatch(contents, "([^\r\n]*)" .. os_newline) do
+  for line in string.gmatch(contents, "([^\n]*)\n") 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