This interface is used to run commands via sudo and provides platform consistency handling, which can be used for scripts that require root privileges to run.
::: tip NOTE In order to ensure security, unless you must use it, try not to use this interface in other cases. :::
At present, sudo is supported only under macosx/linux. The administrator privilege running on Windows is not supported yet. Therefore, it is recommended to use the interface to judge the support situation before use.
import("privilege.sudo")
if sudo.has() then
sudo.run("rm /system/file")
end
For specific usage, please refer to: os.run.
import("privilege.sudo")
sudo.run("rm /system/file")
For specific usage, please refer to: os.runv.
For specific usage, please refer to: os.exec.
For specific usage, please refer to: os.execv.
For specific usage, please refer to: os.iorun.
For specific usage, please refer to: os.iorunv.