Skip to content

Commit

Permalink
Error checking for postaction, correct xetex postaction
Browse files Browse the repository at this point in the history
  • Loading branch information
hmenke committed Jan 16, 2020
1 parent 5df1220 commit beb3f21
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions build.lua
Expand Up @@ -154,7 +154,7 @@ local function manual()
},
xetex = {
latex = "xelatex --no-pdf --interaction=nonstopmode --halt-on-error pgfmanual.tex",
postaction = "xdvipdfmx -p a4 pgfmanual.dvi"
postaction = "xdvipdfmx -p a4 pgfmanual.xdv"
}
}

Expand Down Expand Up @@ -188,7 +188,7 @@ local function manual()

for _, line in ipairs(log) do
if string.match(line, "There were undefined references") or
string.match(line, "Rerun to get cross%-references right") or
string.match(line, "Rerun to get cross%-references right") or
string.match(line, "Rerun to get the bars right") then
rerun = true
break
Expand All @@ -205,10 +205,17 @@ local function manual()

-- Run the postaction
if type(enginesettings[engine].postaction) == "string" then
os.execute(enginesettings[engine].postaction)
local action = enginesettings[engine].postaction
local success, exit, signal = os.execute(action)
if not success then
error("There were errors during \"" .. tostring(action) .. "\"")
end
elseif type(enginesettings[engine].postaction) == "table" then
for _, action in ipairs(enginesettings[engine].postaction) do
os.execute(action)
local success, exit, signal = os.execute(action)
if not success then
error("There were errors during \"" .. tostring(action) .. "\"")
end
end
end

Expand Down Expand Up @@ -376,7 +383,7 @@ tasks.help = function()
print("Available commands:")
for task in pairs(tasks) do
print(" " .. task)
end
end
end
local task = tasks[arg[1] or "help"]
task()

0 comments on commit beb3f21

Please sign in to comment.