aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticommon.lua
diff options
context:
space:
mode:
Diffstat (limited to 'apt-panopticommon.lua')
-rw-r--r--apt-panopticommon.lua29
1 files changed, 27 insertions, 2 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua
index e31c22f..982ff21 100644
--- a/apt-panopticommon.lua
+++ b/apt-panopticommon.lua
@@ -90,7 +90,7 @@ APT.options =
90 { 90 {
91 typ = "number", 91 typ = "number",
92 help = "", 92 help = "",
93 value = 5, 93 value = 24,
94 }, 94 },
95 timeouts = 95 timeouts =
96 { 96 {
@@ -501,6 +501,8 @@ APT.readCmd = function(cmd)
501 table.insert(result, l) 501 table.insert(result, l)
502 end 502 end
503 end 503 end
504 -- While this does return the same things as os.execute(), it's just as useless.
505 output:close()
504 return result 506 return result
505end 507end
506 508
@@ -590,8 +592,9 @@ APT.exe = function(c)
590 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.
591 local ok, rslt, status = os.execute(s) 593 local ok, rslt, status = os.execute(s)
592 ]] 594 ]]
595
593 local f = APT.readCmd(self.cmd, 'r') 596 local f = APT.readCmd(self.cmd, 'r')
594 -- The last line will be the command's returned status, collect everything else in result. 597 -- The last line will be the command's returned status, collect everything else in result.
595 self.status = '' -- Otherwise the result starts with 0. 598 self.status = '' -- Otherwise the result starts with 0.
596 self.result = '\n' 599 self.result = '\n'
597 for i,l in ipairs(f) do 600 for i,l in ipairs(f) do
@@ -608,6 +611,28 @@ APT.exe = function(c)
608 E("status |" .. self.status .. '| ' .. self.command) 611 E("status |" .. self.status .. '| ' .. self.command)
609 end 612 end
610 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.
617 local f = APT.readCmd(self.cmd .. '; echo "$?"', 'r')
618 -- The last line will be the command's returned status, collect everything else in result.
619 self.status = tonumber(f[#f])
620 f[#f] = nil
621 self.result = '\n'
622 for i,l in ipairs(f) do
623 self.result = self.result .. l .. "\n"
624 end
625 if (137 == self.status) or (124 == self.status) then
626 print("timeout killed " .. self.status .. ' ' .. self.command)
627 print('ERROR ' .. "timeout killed " .. self.status .. ' ' .. self.command)
628 elseif (nil == self.status) then
629 print("status |" .. "NIL" .. '| ' .. self.command)
630 E("status |" .. "NIL" .. '| ' .. self.command)
631 elseif (0 ~= self.status) then
632-- print("status |" .. self.status .. '| ' .. self.command)
633 E("status |" .. self.status .. '| ' .. self.command)
634 end
635]]
611 return self 636 return self
612 end 637 end
613 function exe:fork(host) 638 function exe:fork(host)