summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/luat-run.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/luat-run.lua')
-rw-r--r--tex/context/base/mkiv/luat-run.lua36
1 files changed, 29 insertions, 7 deletions
diff --git a/tex/context/base/mkiv/luat-run.lua b/tex/context/base/mkiv/luat-run.lua
index 39384b7b1..ed4d5f5e7 100644
--- a/tex/context/base/mkiv/luat-run.lua
+++ b/tex/context/base/mkiv/luat-run.lua
@@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['luat-run'] = {
local next = next
local format, find = string.format, string.find
local insert, remove = table.insert, table.remove
+local osexit = os.exit
-- trace_job_status is also controlled by statistics.enable that is set via the directive system.nostatistics
@@ -64,8 +65,9 @@ local function stop_run()
end
end
if quit then
- if status.setexitcode then
- status.setexitcode(1)
+ local setexitcode = lua.setexitcode or status.setexitcode
+ if setexitcode then
+ setexitcode(1)
if type(quit) == "table" then
logs.newline()
report_tex("quitting due to: %, t",quit)
@@ -117,14 +119,18 @@ end
-- For Taco ...
-local sequencers = utilities.sequencers
-local appendgroup = sequencers.appendgroup
-local appendaction = sequencers.appendaction
-local wrapupactions = sequencers.new { }
+local sequencers = utilities.sequencers
+local appendgroup = sequencers.appendgroup
+local appendaction = sequencers.appendaction
+local wrapupactions = sequencers.new { }
+local cleanupactions = sequencers.new { }
appendgroup(wrapupactions,"system")
appendgroup(wrapupactions,"user")
+appendgroup(cleanupactions,"system")
+appendgroup(cleanupactions,"user")
+
local function wrapup_run()
local runner = wrapupactions.runner
if runner then
@@ -132,10 +138,26 @@ local function wrapup_run()
end
end
+local function cleanup_run()
+ local runner = cleanupactions.runner
+ if runner then
+ runner()
+ end
+end
+
function luatex.wrapup(action)
appendaction(wrapupactions,"user",action)
end
+function luatex.cleanup(action)
+ appendaction(cleanupactions,"user",action)
+end
+
+function luatex.abort()
+ cleanup_run()
+ osexit(1)
+end
+
appendaction(wrapupactions,"system",synctex.wrapup)
-- this can be done later
@@ -243,7 +265,7 @@ local function report_stop()
end
end
-if not CONTEXTLMTXMODE then
+if CONTEXTLMTXMODE < 2 then
local types = {
"data",