X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fsys%2Fluasrc%2Fsys.lua;h=e27e1c4e8ae6a0a1f180d695682fd86e1bc0d9bf;hp=a53db937c70e82bd1cda0b76ef28dfacee9eca00;hb=aa0617e4edd3fa2f3dfb464c10b6d73214b79283;hpb=9243e20e27010a1d5754506774a3d813c7d5b8b0 diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index a53db937c..e27e1c4e8 100644 --- a/libs/sys/luasrc/sys.lua +++ b/libs/sys/luasrc/sys.lua @@ -41,6 +41,20 @@ local tonumber, ipairs, pairs = tonumber, ipairs, pairs --- LuCI Linux and POSIX system utilities. module "luci.sys" +--- Execute a given shell command and return the error code +-- @class function +-- @name call +-- @param ... Command to call +-- @return Error code of the command +function call(...) + return os.execute(...) / 256 +end + +--- 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 exec = luci.util.exec --- Invoke the luci-flash executable to write an image to the flash memory.