From eb2d602e3c763448c94ccc702f3054d0c787daf9 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Tue, 12 Dec 2023 17:10:16 +0300 Subject: [PATCH] fix(cli): Stop outputting error messages twice on failure to process main file --- core/utilities.lua | 2 +- sile.in | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/utilities.lua b/core/utilities.lua index 90418e3ec..92752ce85 100644 --- a/core/utilities.lua +++ b/core/utilities.lua @@ -39,7 +39,7 @@ utilities.error = function (message, isbug) io.stderr:flush() SILE.outputter:finish() -- Only really useful from the REPL but no harm in trying SILE.scratch.caughterror = true - error(message, 2) + error("", 2) end utilities.warn = function (message, isbug) diff --git a/sile.in b/sile.in index 61f0f065d..6606f7c39 100755 --- a/sile.in +++ b/sile.in @@ -52,15 +52,15 @@ if SILE.input.filenames and #SILE.input.filenames >= 1 then SILE.use(spec.module, spec.options) end - local main, err = xpcall(function() + local process_status, error_msg = xpcall(function() pl.tablex.imap(SILE.processFile, SILE.input.filenames) end, SILE.errorHandler) - if not main then - if type(err) == "string" and err:match(": interrupted!") then + if not process_status then + if type(error_msg) == "string" and error_msg:match(": interrupted!") then SILE.outputter:finish() else - io.stderr:write("\nerror summary:\n\t" .. tostring(err) .. "\n") + io.stderr:write("\nerror summary:\n\t" .. tostring(error_msg) .. "\n") end os.exit(1) end