From 5736ed4bbd066e4675977d61a4ea83a146dd710d Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 1 Jan 2013 16:54:18 +0000 Subject: Replaced io.popen with modelfunctions.run_executable --- fetchmail-model.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fetchmail-model.lua b/fetchmail-model.lua index d7a4e53..bfe07b9 100644 --- a/fetchmail-model.lua +++ b/fetchmail-model.lua @@ -397,13 +397,11 @@ function startstop_service(self, startstop, action) if action and (action:lower() == "run" or action:lower() == "test") then local cmd if action:lower() == "run" then - cmd = 'su -s /bin/sh -c "/usr/bin/fetchmail -d0 -v --nosyslog -f '..configfile..' 2>&1" - fetchmail' + cmd = "/usr/bin/fetchmail -d0 -v --nosyslog -f "..configfile elseif action:lower() == "test" then - cmd = 'su -s /bin/sh -c "/usr/bin/fetchmail -d0 -v -k --nosyslog -f '..configfile..' 2>&1" - fetchmail' + cmd = "/usr/bin/fetchmail -d0 -v -k --nosyslog -f "..configfile end - local f = io.popen(cmd) - startstop.descr = f:read("*a") - f:close() + startstop.descr, startstop.errtxt = modelfunctions.run_executable({"su", "-s", "/bin/sh", "-c", cmd, "-", "fetchmail"}, true) else startstop.errtxt = "Invalid action" end -- cgit v1.2.3