diff options
author | sumneko <sumneko@hotmail.com> | 2019-06-03 11:52:43 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-06-03 11:52:43 +0800 |
commit | e938352367e8a44c280bbe156d4d7b9a3c21d882 (patch) | |
tree | e31c194c9d64645588f8fbba64ac04eda04d41e9 | |
parent | 89b5d63a2baad1f13d7d7abd2e1986da2625cfc7 (diff) | |
download | lua-language-server-e938352367e8a44c280bbe156d4d7b9a3c21d882.zip |
修正计时器回调中的错误会导致语言服务崩溃的bug
-rw-r--r-- | server/src/log.lua | 1 | ||||
-rw-r--r-- | server/src/timer.lua | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/server/src/log.lua b/server/src/log.lua index 043ec43a..af4212e1 100644 --- a/server/src/log.lua +++ b/server/src/log.lua @@ -43,6 +43,7 @@ local function push_log(level, ...) local str = table.concat(t, '\t', 1, t.n) if level == 'error' then str = str .. '\n' .. debug.traceback(nil, 3) + io.stderr:write(str .. '\n') end init_log_file() if not log.file then diff --git a/server/src/timer.lua b/server/src/timer.lua index f477dccf..dc36e6a0 100644 --- a/server/src/timer.lua +++ b/server/src/timer.lua @@ -42,7 +42,7 @@ local function mWakeup(self) end self._running = false if self._onTimer then - self:_onTimer() + xpcall(self._onTimer, log.error, self) end if self._removed then return |