Skip to content

Commit

Permalink
fix(cli): Stop outputting error messages twice on failure to process …
Browse files Browse the repository at this point in the history
…main file
  • Loading branch information
alerque committed Dec 12, 2023
1 parent 49086ec commit eb2d602
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/utilities.lua
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions sile.in
Expand Up @@ -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
Expand Down

0 comments on commit eb2d602

Please sign in to comment.