aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticommon.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--apt-panopticommon.lua23
1 files changed, 23 insertions, 0 deletions
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)
592 I'm getting 7168 or 0. No idea what the fuck that is. 592 I'm getting 7168 or 0. No idea what the fuck that is.
593 local ok, rslt, status = os.execute(s) 593 local ok, rslt, status = os.execute(s)
594 ]] 594 ]]
595
596 local f = APT.readCmd(self.cmd, 'r')
597 -- The last line will be the command's returned status, collect everything else in result.
598 self.status = '' -- Otherwise the result starts with 0.
599 self.result = '\n'
600 for i,l in ipairs(f) do
601 self.result = self.result .. l .. "\n"
602 end
603 f = APT.readCmd('echo "$?"', 'r')
604 for i,l in ipairs(f) do
605 self.status = tonumber(l)
606 if (137 == self.status) or (124 == self.status) then
607 print("timeout killed " .. self.status .. ' ' .. self.command)
608 E("timeout killed " .. self.status .. ' ' .. self.command)
609 elseif (0 ~= self.status) then
610 print("status |" .. self.status .. '| ' .. self.command)
611 E("status |" .. self.status .. '| ' .. self.command)
612 end
613 end
614
615--[[ While this is more reliable, it breaks stuff that's likely making assumptions that match the old way.
616TODO - fix it later.
595 local f = APT.readCmd(self.cmd .. '; echo "$?"', 'r') 617 local f = APT.readCmd(self.cmd .. '; echo "$?"', 'r')
596 -- The last line will be the command's returned status, collect everything else in result. 618 -- The last line will be the command's returned status, collect everything else in result.
597 self.status = tonumber(f[#f]) 619 self.status = tonumber(f[#f])
@@ -610,6 +632,7 @@ APT.exe = function(c)
610-- print("status |" .. self.status .. '| ' .. self.command) 632-- print("status |" .. self.status .. '| ' .. self.command)
611 E("status |" .. self.status .. '| ' .. self.command) 633 E("status |" .. self.status .. '| ' .. self.command)
612 end 634 end
635]]
613 return self 636 return self
614 end 637 end
615 function exe:fork(host) 638 function exe:fork(host)