Skip to content

Commit ca77802

Browse files
committed
Added "alldone" message.
1 parent a68ef4d commit ca77802

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

preprocess-cl.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ exec lua "$0" "$@"
163163
path: The file being processed.
164164
error: The error message.
165165
166+
"alldone"
167+
Sent after all other messages (right before the program exits).
168+
Arguments:
169+
(none)
170+
166171
--============================================================]]
167172

168173
local startTime = os.time()
@@ -630,11 +635,13 @@ printfNoise(
630635
formatBytes(byteCount)
631636
)
632637

638+
sendMessage("alldone")
639+
633640

634641

635642
--[[!===========================================================
636643
637-
Copyright © 2018-2021 Marcus 'ReFreezed' Thunström
644+
Copyright © 2018-2022 Marcus 'ReFreezed' Thunström
638645
639646
Permission is hereby granted, free of charge, to any person obtaining a copy
640647
of this software and associated documentation files (the "Software"), to deal

tests/suite.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ doTest("Messages", function()
933933
aftermeta = function(path, lua ) return "-- Hello\n"..lua end,
934934
filedone = function(path, outPath, info) assert(outPath == "temp/generatedTest.lua") ; assert(type(info) == "table") end,
935935
fileerror = function(path, err ) end,
936+
alldone = function( ) end,
936937
}]]
937938
or [[ return function(message, ...)
938939
if message == "init" then local inPaths, outPaths = ... ; assert(not outPaths) ; table.insert(inPaths, "temp/generatedTest.lua2p")
@@ -941,7 +942,8 @@ doTest("Messages", function()
941942
elseif message == "aftermeta" then local path, lua = ... ; return "-- Hello\n"..lua
942943
elseif message == "filedone" then local path, outPath, info = ... ; assert(outPath == "temp/generatedTest.lua") ; assert(type(info) == "table")
943944
elseif message == "fileerror" then local path, err = ...
944-
else error(message) end
945+
elseif message == "alldone" then -- void
946+
else error("Unhandled message '"..tostring(message).."'") end
945947
end]]
946948
)
947949

0 commit comments

Comments
 (0)