From e031a353305dbf4ba43f626ea9215b9578ca13d7 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Mon, 9 Feb 2015 23:48:45 +0800 Subject: [PATCH] support empty line --- lualib/skynet/remotedebug.lua | 32 +++++++++++++++++--------------- service/debug_console.lua | 4 +--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lualib/skynet/remotedebug.lua b/lualib/skynet/remotedebug.lua index 8e0c86c1..06dbeb03 100644 --- a/lualib/skynet/remotedebug.lua +++ b/lualib/skynet/remotedebug.lua @@ -65,25 +65,27 @@ local function hook_dispatch(dispatcher, resp, fd, channel) if cmd == "cont" then break end - if sleep then - if cmd == "c" then - print "continue..." - prompt = string.format(":%08x>", address) - newline = true - return + if cmd ~= "" then + if sleep then + if cmd == "c" then + print "continue..." + prompt = string.format(":%08x>", address) + newline = true + return + end end - end - local f = load("return "..cmd, "=(debug)", "t", env) - if not f then - local err - f,err = load(cmd, "=(debug)", "t", env) + local f = load("return "..cmd, "=(debug)", "t", env) if not f then - socket.write(fd, err .. "\n") + local err + f,err = load(cmd, "=(debug)", "t", env) + if not f then + socket.write(fd, err .. "\n") + end + end + if f then + print(select(2,pcall(f))) end - end - if f then - print(select(2,pcall(f))) end newline = true else diff --git a/service/debug_console.lua b/service/debug_console.lua index 75db9343..0133d293 100644 --- a/service/debug_console.lua +++ b/service/debug_console.lua @@ -228,9 +228,7 @@ function COMMAND.debug(address, fd) skynet.send(agent, "lua", "cmd", "cont") break end - if cmdline ~= "" then - skynet.send(agent, "lua", "cmd", cmdline) - end + skynet.send(agent, "lua", "cmd", cmdline) until stop or cmdline == "cont" end) skynet.call(agent, "lua", "start", address, fd)