diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-07-03 01:48:10 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-07-03 01:48:10 +0200 |
commit | 1a42a842639df21d4738bb8ac12f146d829a9d17 (patch) | |
tree | 88e65914ef5e9a19ac3f635fde288725ef72f80d /luaotfload-tool.lua | |
parent | cba3f693b07b52734aa8ef6c35eb99ac4946ba04 (diff) | |
download | luaotfload-1a42a842639df21d4738bb8ac12f146d829a9d17.tar.gz |
add option to redirect log output to file
Diffstat (limited to 'luaotfload-tool.lua')
-rwxr-xr-x | luaotfload-tool.lua | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index 45a75ba..392be6e 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -902,6 +902,22 @@ actions.list = function (job) return true, true end +--- stuff to be carried out prior to exit + +local finalizers = { } + +--- returns false if at least one of the actions failed, mainly +--- for closing io channels +local finalize = function () + local success = true + for _, fun in next, finalizers do + if type (fun) == "function" then + if fun () == false then success = false end + end + end + return success +end + --[[-- Command-line processing. mkluatexfontdb.lua relies on the script alt_getopt to process argv and @@ -985,7 +1001,7 @@ local process_cmdline = function ( ) -- unit -> jobspec elseif v == "log" then local str = optarg[n] if str then - logs.set_logout(str) + finalizers = logs.set_logout(str, finalizers) end elseif v == "find" then action_pending["query"] = true @@ -1065,7 +1081,11 @@ local main = function ( ) -- unit -> int if exit then break end end - texiowrite_nl"" + if finalize () == false then + retval = -1 + end + + --texiowrite_nl"" return retval end |