diff options
author | Jo-Philipp Wich <jo@mein.io> | 2018-12-02 20:15:34 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-12-10 13:41:34 +0100 |
commit | df9ba6981ee224ca37591469cf658db786b031b9 (patch) | |
tree | 28d5acd57f212b0714dba93e61e6214b4d0d6da2 /modules/luci-mod-status/luasrc/controller/admin | |
parent | 1b26c91a085c68d628b3098e52e85fb5f30b9af0 (diff) |
luci-mod-status: switch iptables_dump action to luci.sys.process.exec
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-status/luasrc/controller/admin')
-rw-r--r-- | modules/luci-mod-status/luasrc/controller/admin/status.lua | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/modules/luci-mod-status/luasrc/controller/admin/status.lua b/modules/luci-mod-status/luasrc/controller/admin/status.lua index 63b9390775..0d955c95fe 100644 --- a/modules/luci-mod-status/luasrc/controller/admin/status.lua +++ b/modules/luci-mod-status/luasrc/controller/admin/status.lua @@ -52,22 +52,12 @@ function dump_iptables(family, table) local s for s in lines do if s == table then - local ipt = io.popen( - "/usr/sbin/%stables -w -t %s --line-numbers -nxvL" - %{ prefix, table }) - - if ipt then - luci.http.prepare_content("text/plain") - - while true do - s = ipt:read(1024) - if not s then break end - luci.http.write(s) - end - - ipt:close() - return - end + luci.http.prepare_content("text/plain") + luci.sys.process.exec({ + "/usr/sbin/%stables" % prefix, "-w", "-t", table, + "--line-numbers", "-nxvL" + }, luci.http.write) + return end end end |