test(lsp): fix fake LSP server timeout not working (#37970)

Problem:  Fake LSP server does not timeout or respond to SIGTERM as it
          does not run the event loop.
Solution: Instead of io.read(), use stdioopen()'s on_stdin callback to
          accumulate input and use vim.wait() to wait for input.

Also, in the test suite, don't stop a session when it's not running, as
calling uv.stop() outside uv.run() will instead cause the next uv.run()
to stop immediately, which cancels the next RPC request.
This commit is contained in:
zeertzjq
2026-02-20 02:38:14 +08:00
committed by GitHub
parent 08f4811061
commit dec3c6fa34
4 changed files with 62 additions and 26 deletions

View File

@@ -110,6 +110,7 @@ M.create_server_definition = function()
function srv.terminate()
closing = true
dispatchers.on_exit(0, 15)
end
return srv