From 45ea340efc6caeb5fd07ab96d1ab8139e1a6ec57 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 26 Jan 2009 21:54:28 +0000 Subject: More work to remove unnecessary popen calls. git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@1696 ab2d0c66-481e-0410-8bed-d214d4d58bed --- shorewall-model.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'shorewall-model.lua') diff --git a/shorewall-model.lua b/shorewall-model.lua index 694bb56..1d78ebb 100644 --- a/shorewall-model.lua +++ b/shorewall-model.lua @@ -193,10 +193,12 @@ function startstop_service(action) end function configcheck () - local f = io.popen("/bin/echo -n '>> Check starts at: ';/bin/date; /bin/echo; /etc/init.d/shorewall check 2>&1; /bin/echo; /bin/echo -n '>> Check stops at: '; /bin/date;") - local checkresult = f:read("*a") + local checkresult = {">> Check starts at: " .. os.date() .. "\n"} + local f = io.popen("/etc/init.d/shorewall check 2>&1") + checkresult[2] = f:read("*a") or "" f:close() - return cfe({ type="longtext", value=checkresult, label="Result of checking config" }) + checkresult[3] = ">> Check stops at: "..os.date() + return cfe({ type="longtext", value=table.concat(checkresult, "\n"), label="Result of checking config" }) end function getlogfile () -- cgit v1.2.3