mirror of
https://github.com/lukaszraczylo/filepuff-mcp.git
synced 2026-10-14 05:30:19 +00:00
docs(lsp): clarify drainStderr cancellation relies on pipe EOF
The goroutine parks in the blocking stderr.Read, so closing c.done does not interrupt it; termination relies on the read erroring at pipe EOF when the process is killed. The c.done select is only a best-effort fast path.
This commit is contained in:
@@ -121,6 +121,12 @@ func NewClient(cmd *exec.Cmd) (*Client, error) {
|
|||||||
|
|
||||||
// drainStderr consumes stderr output to prevent the LSP server from blocking.
|
// drainStderr consumes stderr output to prevent the LSP server from blocking.
|
||||||
// LSP servers may write diagnostic messages to stderr which we discard.
|
// LSP servers may write diagnostic messages to stderr which we discard.
|
||||||
|
//
|
||||||
|
// Cancellation note: the goroutine parks in the blocking stderr.Read below, so
|
||||||
|
// closing c.done does not interrupt it directly — termination relies on the
|
||||||
|
// read returning an error when the pipe reaches EOF (the process is killed on
|
||||||
|
// Close). The c.done check is only a best-effort fast path for the case where
|
||||||
|
// done is already closed between reads.
|
||||||
func (c *Client) drainStderr() {
|
func (c *Client) drainStderr() {
|
||||||
buf := make([]byte, StderrBufferSize)
|
buf := make([]byte, StderrBufferSize)
|
||||||
for {
|
for {
|
||||||
|
|||||||
Reference in New Issue
Block a user