aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticommon.lua
diff options
context:
space:
mode:
Diffstat (limited to 'apt-panopticommon.lua')
-rw-r--r--apt-panopticommon.lua19
1 files changed, 16 insertions, 3 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua
index 221c7e3..9de97b4 100644
--- a/apt-panopticommon.lua
+++ b/apt-panopticommon.lua
@@ -483,6 +483,17 @@ local E = APT.E
483local C = APT.C 483local C = APT.C
484 484
485 485
486APT.readCmd = function(cmd)
487 local result = {}
488 local output = io.popen(cmd)
489 if nil ~= output then
490 for l in output:lines() do
491 table.insert(result, l)
492 end
493 end
494 return result
495end
496
486APT.debians = {} 497APT.debians = {}
487APT.mirrors = {} 498APT.mirrors = {}
488 499
@@ -559,10 +570,10 @@ APT.exe = function(c)
559 I'm getting 7168 or 0. No idea what the fuck that is. 570 I'm getting 7168 or 0. No idea what the fuck that is.
560 local ok, rslt, status = os.execute(s) 571 local ok, rslt, status = os.execute(s)
561 ]] 572 ]]
562 local f = io.popen(self.cmd .. ' ; echo "$?"', 'r') 573 local f = APT.readCmd(self.cmd .. ' ; echo "$?"', 'r')
563 -- The last line will be the command's returned status, collect everything else in result. 574 -- The last line will be the command's returned status, collect everything else in result.
564 self.status = '' -- Otherwise the result starts with 0. 575 self.status = '' -- Otherwise the result starts with 0.
565 for l in f:lines() do 576 for i,l in ipairs(f) do
566 self.result = self.result .. self.status .. "\n" 577 self.result = self.result .. self.status .. "\n"
567 self.status = l 578 self.status = l
568 end 579 end
@@ -579,7 +590,9 @@ APT.exe = function(c)
579end 590end
580 591
581APT.checkExes = function (exe) 592APT.checkExes = function (exe)
582 local count = io.popen('ps x | grep "' .. exe .. '" | grep -v " grep " | grep -v "flock -n apt-panopticon.lock " | wc -l'):read("*l") 593 local count = 0
594 local ps = io.popen('ps x | grep "' .. exe .. '" | grep -v " grep " | grep -v "flock -n apt-panopticon.lock " | wc -l')
595 if nil ~= ps then count = ps:read("*l") end
583 D(count .. " " .. exe .. " commands still running.") 596 D(count .. " " .. exe .. " commands still running.")
584 return tonumber(count) 597 return tonumber(count)
585end 598end