api.sh
The api.sh
module provides functions for executing shell commands.
warning
This module works only if the rule is unsafe.
command
Arguments:
command
(string): The command to execute.
Returns:
output
(string): The output of the command.error
(error): The error message if the command fails.
Example usage:
#![unsafe]
function ls()
output, err = api.sh.command("ls -l")
if err ~= nil then
api.info.Error("Error occured while executing the command: " .. err)
return false
end
return true
end