diff options
author | Christian Pointner <equinox@anylike.org> | 2010-05-30 22:47:56 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anylike.org> | 2010-05-30 22:47:56 +0000 |
commit | fb71d19cf723f4f36a4c18fd5c55e7609ca6a60b (patch) | |
tree | fcca377a716e290fe9d184dfbd5047089f494643 | |
parent | quit vs terminate (diff) |
added help command to debug shell
-rw-r--r-- | src/debug_shell.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/debug_shell.lua b/src/debug_shell.lua index e8ba6ef..489395a 100644 --- a/src/debug_shell.lua +++ b/src/debug_shell.lua @@ -124,6 +124,7 @@ end debug_shell.exec_cmd = function() log.printf(log.DEBUG, "debug shell: received string: '%s'", debug_shell.buffer) + local ret = 0 local luacode = string.match(debug_shell.buffer, "^!(.*)$"); if(luacode and luacode ~= "") then local chunk = loadstring(luacode) @@ -148,11 +149,17 @@ debug_shell.exec_cmd = function() if(cmd == 'quit') then if(sep and sep ~= "") then return 0 end log.printf(log.INFO, "debug shell: quitting debug session") - return 1 + ret = 1 elseif(cmd == 'terminate') then if(sep and sep ~= "") then return 0 end log.printf(log.NOTICE, "debug shell: terminate command received") - return 2 + ret = 2 + elseif(cmd == 'help') then + if(sep and sep ~= "") then return 0 end + debug_shell.socks[2]:send("!<lua code> execute lua code\n" .. + "quit quit this debug session\n" .. + "ping[ <data>] echo request (response will be 'pong[ <data>]')\n" .. + "terminate terminate the daemon\n") elseif(cmd == 'ping') then if(sep == ' ') then debug_shell.socks[2]:send("pong " .. (param or "") .. "\n") else debug_shell.socks[2]:send("pong\n") end @@ -161,5 +168,5 @@ debug_shell.exec_cmd = function() end end - return 0 + return ret end |