summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2012-05-04 13:38:22 +0000
committerTed Trask <ttrask01@yahoo.com>2012-05-04 13:38:22 +0000
commit556190bcfcc48abf93ac23a01a0ff85e62b92a8f (patch)
treec08e1e81f06cab63018413138d2e2c74e36aeb3e
parentb0321be1c949491ea8cb2d9e4c075190397d4a87 (diff)
downloadacf-lib-556190bcfcc48abf93ac23a01a0ff85e62b92a8f.tar.bz2
acf-lib-556190bcfcc48abf93ac23a01a0ff85e62b92a8f.tar.xz
Remove duplicate actions in daemon_actions
-rw-r--r--processinfo.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/processinfo.lua b/processinfo.lua
index a3840fa..d4f20a9 100644
--- a/processinfo.lua
+++ b/processinfo.lua
@@ -128,6 +128,10 @@ end
function daemon_actions (process)
local actions = {"status", "start", "stop", "restart", "describe", "zap"}
+ local reverse = {}
+ for i,a in ipairs(actions) do
+ reverse[a] = i
+ end
local description
local res, err = daemoncontrol(process, "describe")
if err then
@@ -136,7 +140,11 @@ function daemon_actions (process)
lines = format.string_to_table(res, "\n")
description = string.match(lines[1], "^%s*%*%s*(.*)")
for i=2,#lines,1 do
- actions[#actions+1] = string.match(lines[i], "^%s*%*%s*([^:]*)")
+ local act = string.match(lines[i], "^%s*%*%s*([^:]*)")
+ if act and not reverse[act] then
+ actions[#actions+1] = act
+ reverse[act] = #actions
+ end
end
end
return actions, description