[tex4ht-commits] [SCM] tex4ht updated: r732 - trunk/lit

michal_h21 at gnu.org.ua michal_h21 at gnu.org.ua
Sun Jun 7 13:47:33 CEST 2020


Author: michal_h21
Date: 2020-06-07 14:47:33 +0300 (Sun, 07 Jun 2020)
New Revision: 732

Modified:
   trunk/lit/checklog.lua
Log:
We can read log file also from stdin

Modified: trunk/lit/checklog.lua
===================================================================
--- trunk/lit/checklog.lua	2020-06-07 11:45:24 UTC (rev 731)
+++ trunk/lit/checklog.lua	2020-06-07 11:47:33 UTC (rev 732)
@@ -10,16 +10,22 @@
 local error_logparser = require("make4ht-errorlogparser")
 
 local input_file = arg[1]
-local ext = input_file:match("%.([^%.]+)$")
-if not ext then
-  input_file = input_file .. ".log"
-elseif ext ~="log" then
-  input_file = input_file:gsub("[^%.]+$", "log")
+local content 
+-- the log file can be passed as filename argument, or piped from shell
+if input_file then
+  local ext = input_file:match("%.([^%.]+)$")
+  if not ext then
+    input_file = input_file .. ".log"
+  elseif ext ~="log" then
+    input_file = input_file:gsub("[^%.]+$", "log")
+  end
+
+  local f = io.open(input_file, "r")
+  content = f:read("*all")
+else
+  -- read from STDIN
+  content = io.read("*all")
 end
-
-print(input_file)
-local f = io.open(input_file, "r")
-local content = f:read("*all")
 -- log parsing can be expensive on time, don't do it if we don't have
 -- any error message in the log file
 if content:match("\n!") then



More information about the tex4ht-commits mailing list.