Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit 49b0843

Browse files
authored
Merge pull request #56 from bfredl/eof
fix(session): raise an error on EOF instead of implicit `nil` response
2 parents 387fdb3 + 9d6d8a3 commit 49b0843

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nvim/session.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function Session:_blocking_request(method, args)
164164
end)
165165

166166
self:_run(on_request, on_notification)
167-
return err, result
167+
return (err or self.eof_err), result
168168
end
169169

170170
function Session:_run(request_cb, notification_cb, timeout)
@@ -176,7 +176,10 @@ function Session:_run(request_cb, notification_cb, timeout)
176176
self._prepare:stop()
177177
end)
178178
end
179-
self._msgpack_rpc_stream:read_start(request_cb, notification_cb, uv.stop)
179+
self._msgpack_rpc_stream:read_start(request_cb, notification_cb, function()
180+
uv.stop()
181+
self.eof_err = {1, "EOF was received from Nvim. Likely the Nvim process crashed."}
182+
end)
180183
uv.run()
181184
self._prepare:stop()
182185
self._timer:stop()

0 commit comments

Comments
 (0)