Translated using Weblate (Portuguese)
[oweals/luci.git] / modules / luci-base / luasrc / sys.luadoc
index 72a16a1ab015bdfa22db7654692df778c670cd45..162650e7ac025adfc53976405e54a760e1243930 100644 (file)
@@ -1,8 +1,7 @@
 ---[[
 LuCI Linux and POSIX system utilities.
-
-module "luci.sys"
 ]]
+module "luci.sys"
 
 ---[[
 Execute a given shell command and return the error code
@@ -19,7 +18,7 @@ Execute a given shell command and capture its standard output
 @class         function
 @name          exec
 @param command Command to call
-@return                        String containg the return the output of the command
+@return                        String containing the return the output of the command
 ]]
 
 ---[[
@@ -39,7 +38,7 @@ exists.
 @class         function
 @name          getenv
 @param var     Name of the environment variable to retrieve (optional)
-@return                String containg the value of the specified variable
+@return                String containing the value of the specified variable
 @return                Table containing all variables if no variable name is given
 ]]
 
@@ -151,6 +150,16 @@ Returns a two-dimensional table of IPv6 address hints.
          [ "ip", "name" ]
 ]]
 
+---[[
+Returns a two-dimensional table of host hints.
+
+@class function
+@name net.host_hints
+@return  Table of table containing known hosts from various sources,
+         indexed by mac address. Each subtable contains at least one
+         of the fields "name", "ipv4" or "ipv6".
+]]
+
 ---[[
 Returns conntrack information
 
@@ -262,6 +271,42 @@ Send a signal to a process identified by given pid.
 @return                Number containing the error code if failed
 ]]
 
+---[[
+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.
+
+@class function
+@name  process.exec
+@param commend Table containing the argv vector to execute
+@param stdout  Callback function or boolean to indicate capturing (optional)
+@param stderr  Callback function or boolean to indicate capturing (optional)
+@param nowait  Don't wait for process termination when true (optional)
+@return                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.
+]]
+
 ---[[
 LuCI system utilities / user related functions.
 
@@ -270,7 +315,7 @@ LuCI system utilities / user related functions.
 ]]
 
 ---[[
-Retrieve user informations for given uid.
+Retrieve user information for given uid.
 
 @class         function
 @name          getuser
@@ -296,7 +341,7 @@ Test whether given string matches the password of a given system user.
 @name user.checkpasswd
 @param username        String containing the Unix user name
 @param pass            String containing the password to compare
-@return                        Boolean indicating wheather the passwords are equal
+@return                        Boolean indicating whether the passwords are equal
 ]]
 
 ---[[