summaryrefslogtreecommitdiff
path: root/script-beta/jsonrpc.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-11 14:32:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-11 14:32:30 +0800
commitf0613517eb750fd96a04d78401a78696afd18a30 (patch)
tree5f61712a160d213afe3347315a440b88293b2222 /script-beta/jsonrpc.lua
parentd0e30d72b3ba8a2c7bd6f74b88ede6d3ae729c98 (diff)
downloadlua-language-server-f0613517eb750fd96a04d78401a78696afd18a30.zip
fix #247 #248 修正标准输入意外关闭后会陷入死循环的bug
Diffstat (limited to 'script-beta/jsonrpc.lua')
-rw-r--r--script-beta/jsonrpc.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/script-beta/jsonrpc.lua b/script-beta/jsonrpc.lua
index 39cd00f5..d4b79c6e 100644
--- a/script-beta/jsonrpc.lua
+++ b/script-beta/jsonrpc.lua
@@ -4,8 +4,6 @@ local tonumber = tonumber
local util = require 'utility'
local log = require 'brave.log'
-_ENV = nil
-
---@class jsonrpc
local m = {}
m.type = 'jsonrpc'
@@ -22,7 +20,10 @@ local function readProtoHead(reader, errHandle)
while true do
local line = reader 'L'
if line == nil then
- break
+ -- 说明管道已经关闭了
+ log.warn('stdin closed!')
+ os.exit(true)
+ return nil
end
if line == '\r\n' then
break