Previous: Hooks, Up: Hook Reference
This section documents the additional Lua functions made available to hook writers.
existonpath(
possible_command)
existonpath("xxdiff")
returns 0 if the
program xxdiff is available.
On Windows, this function automatically appends “.exe” to the
program name. In the previous example, existonpath
would search
for “xxdiff.exe”.
guess_binary(
filespec)
0x00 thru 0x06 0x0E thru 0x1a 0x1c thru 0x1f
include(
scriptfile)
includedir(
scriptpath)
includedirpattern(
scriptpath,
pattern)
is_executable(
filespec)
kill(
pid [,
signal])
make_executable(
filespec)
mkstemp(
template)
Important notice:
To create a temporary file, you must use the temp_file()
function, unless you need to run monotone with the --nostd
option. temp_file()
builds on mkstemp()
and creates a
file in the standard TMP/TEMP directories.
For the definition of temp_file()
, see Default hooks.
sleep(
seconds)
spawn(
executable [,
args ...])
Important notice:
To spawn a process and wait for its completion, use the execute()
function, unless you need to run monotone with the --nostd
option. execute()
builds on spawn()
and wait()
in a standardized way.
wait(
pid)
parse_basic_io(
data)
For example, given this as input:
thingy "foo" "bar" thingy "baz" spork frob "oops"
The output table will be:
{ 1 = { name = "thingy", args = { 1 = "foo", 2 = "bar" } }, 2 = { name = "thingy", args = { 1 = "baz" } }, 3 = { name = "spork", args = { } }, 4 = { name = "frob", args = { 1 = "oops" } } }