From 556190bcfcc48abf93ac23a01a0ff85e62b92a8f Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 4 May 2012 13:38:22 +0000 Subject: Remove duplicate actions in daemon_actions --- processinfo.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3