From f7167f0396b9ffa974400a99d15365c271c0ad2b Mon Sep 17 00:00:00 2001 From: dvs1 Date: Sun, 20 Oct 2024 14:13:58 +1000 Subject: Revert the APT.exe tweaks Fix it later, breaks too much now. --- apt-panopticommon.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'apt-panopticommon.lua') diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index 716b564..982ff21 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua @@ -592,6 +592,28 @@ APT.exe = function(c) I'm getting 7168 or 0. No idea what the fuck that is. local ok, rslt, status = os.execute(s) ]] + + local f = APT.readCmd(self.cmd, 'r') + -- The last line will be the command's returned status, collect everything else in result. + self.status = '' -- Otherwise the result starts with 0. + self.result = '\n' + for i,l in ipairs(f) do + self.result = self.result .. l .. "\n" + end + f = APT.readCmd('echo "$?"', 'r') + for i,l in ipairs(f) do + self.status = tonumber(l) + if (137 == self.status) or (124 == self.status) then + print("timeout killed " .. self.status .. ' ' .. self.command) + E("timeout killed " .. self.status .. ' ' .. self.command) + elseif (0 ~= self.status) then + print("status |" .. self.status .. '| ' .. self.command) + E("status |" .. self.status .. '| ' .. self.command) + end + end + +--[[ While this is more reliable, it breaks stuff that's likely making assumptions that match the old way. +TODO - fix it later. local f = APT.readCmd(self.cmd .. '; echo "$?"', 'r') -- The last line will be the command's returned status, collect everything else in result. self.status = tonumber(f[#f]) @@ -610,6 +632,7 @@ APT.exe = function(c) -- print("status |" .. self.status .. '| ' .. self.command) E("status |" .. self.status .. '| ' .. self.command) end +]] return self end function exe:fork(host) -- cgit v1.1