From d80dd2291ff01d264dfa802b769fa19756f07821 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 5 Nov 2019 09:31:27 +0100 Subject: documentation: update Lua API docs Signed-off-by: Jo-Philipp Wich (cherry picked from commit 2ae6e3c6b3c3b65cd955bb10fb9065beebc5ffd2) --- documentation/api/modules/luci.sys.process.html | 75 +++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'documentation/api/modules/luci.sys.process.html') diff --git a/documentation/api/modules/luci.sys.process.html b/documentation/api/modules/luci.sys.process.html index ffe09bdc20..d3664817cc 100644 --- a/documentation/api/modules/luci.sys.process.html +++ b/documentation/api/modules/luci.sys.process.html @@ -208,6 +208,13 @@ LuCI system utilities / process related functions.

Functions

+ + + + + +
exec (commend, stdout, stderr, nowait)
+
+ + +Execute a process, optionally capturing stdio. + +Executes the process specified by the given argv vector, e.g. +{ "/bin/sh", "-c", "echo 1" } and waits for it to terminate unless a true +value has been passed for the "nowait" parameter. + +When a function value is passed for the stdout or stderr arguments, the passed +function is repeatedly called for each chunk read from the corresponding stdio +stream. The read data is passed as string containing at most 4096 bytes at a +time. + +When a true, non-function value is passed for the stdout or stderr arguments, +the data of the corresponding stdio stream is read into an internal string +buffer and returned as "stdout" or "stderr" field respectively in the result +table. + +When a true value is passed to the nowait parameter, the function does not +await process termination but returns as soon as all captured stdio streams +have been closed or - if no streams are captured - immediately after launching +the process. + + + +

Parameters

+
    + +
  • + commend: Table containing the argv vector to execute +
  • + +
  • + stdout: Callback function or boolean to indicate capturing (optional) +
  • + +
  • + stderr: Callback function or boolean to indicate capturing (optional) +
  • + +
  • + nowait: Don't wait for process termination when true (optional) +
  • + +
+ + + + + + +

Return value:

+Table containing at least the fields "code" which holds the exit + status of the invoked process or "-1" on error and "pid", which + contains the process id assigned to the spawned process. When + stdout and/or stderr capturing has been requested, it additionally + contains "stdout" and "stderr" fields respectively, holding the + captured stdio data as string. + + + +
+ + + +
info ()
-- cgit v1.2.3
exec (commend, stdout, stderr, nowait) + +Execute a process, optionally capturing stdio.
info () @@ -259,6 +266,74 @@ Send a signal to a process identified by given pid.