summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/lua/mtx-watch.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-watch.lua')
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-watch.lua45
1 files changed, 25 insertions, 20 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-watch.lua b/Master/texmf-dist/scripts/context/lua/mtx-watch.lua
index 36a3176c41a..95323f571cf 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-watch.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-watch.lua
@@ -7,14 +7,28 @@ if not modules then modules = { } end modules ['mtx-watch'] = {
}
local helpinfo = [[
---logpath optional path for log files
---watch watch given path [--delay]
---pipe use pipe instead of execute
---delay delay between sweeps
---automachine replace /machine/ in path /<servername>/
---collect condense log files
---cleanup=delay remove files in given path [--force]
---showlog show log data
+<?xml version="1.0"?>
+<application>
+ <metadata>
+ <entry name="name">mtx-watch</entry>
+ <entry name="detail">ConTeXt Request Watchdog</entry>
+ <entry name="version">1.00</entry>
+ </metadata>
+ <flags>
+ <category name="basic">
+ <subcategory>
+ <flag name="logpath"><short>optional path for log files</short></flag>
+ <flag name="watch"><short>watch given path [<ref name="delay]"/></short></flag>
+ <flag name="pipe"><short>use pipe instead of execute</short></flag>
+ <flag name="delay"><short>delay between sweeps</short></flag>
+ <flag name="automachine"><short>replace /machine/ in path /servername/</short></flag>
+ <flag name="collect"><short>condense log files</short></flag>
+ <flag name="cleanup" value="delay"><short>remove files in given path [<ref name="force]"/></short></flag>
+ <flag name="showlog"><short>show log data</short></flag>
+ </subcategory>
+ </category>
+ </flags>
+</application>
]]
local application = logs.application {
@@ -97,7 +111,7 @@ local function glob(files,path) -- some day: sort by name (order prefix) and ati
end
end
-local clock = os.gettimeofday or os.time -- we cannot trust os.clock on linux
+local clock = os.gettimeofday or (socket and socket.gettime) or os.time -- we cannot trust os.clock on linux
-- local function filenamesort(a,b)
-- local fa, da = a[1], a[2]
@@ -227,17 +241,6 @@ function scripts.watch.watch()
end
end
local n, start = 0, time()
---~ local function wait()
---~ io.flush()
---~ if not done then
---~ n = n + 1
---~ if n >= 10 then
---~ report("run time: %i seconds, memory usage: %0.3g MB", difftime(time(),start), (status.luastate_bytes/1024)/1000)
---~ n = 0
---~ end
---~ os.sleep(delay)
---~ end
---~ end
local wtime = 0
local function wait()
io.flush()
@@ -421,6 +424,8 @@ elseif environment.argument("cleanup") then
scripts.watch.save_logs(scripts.watch.cleanup_stale_files())
elseif environment.argument("showlog") then
scripts.watch.show_logs()
+elseif environment.argument("exporthelp") then
+ application.export(environment.argument("exporthelp"),environment.files[1])
else
application.help()
end