Skip to content

Commit 6ebf67e

Browse files
Don't remove drain listeners
1 parent 7c91349 commit 6ebf67e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/server/stdio.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ test("should properly clean up resources when closed", async () => {
123123
const transport = new StdioServerTransport(mockStdin, mockStdout);
124124
await transport.start();
125125

126-
// Send a message to potentially create 'drain' listeners
126+
// Send a message to potentially create listeners
127127
await transport.send({ jsonrpc: "2.0", method: "test", id: 1 });
128128

129129
// Close the transport

src/server/stdio.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,14 @@ export class StdioServerTransport implements Transport {
6262
}
6363

6464
async close(): Promise<void> {
65-
// Remove all event listeners
65+
// Remove our event listeners
6666
this._stdin.off("data", this._ondata);
6767
this._stdin.off("error", this._onerror);
68-
this._stdout.removeAllListeners('drain');
69-
70-
// Destroy both streams
68+
69+
// Destroy streams to ensure they're fully closed
7170
this._stdin.destroy();
7271
this._stdout.destroy();
73-
72+
7473
// Clear the buffer and notify closure
7574
this._readBuffer.clear();
7675
this.onclose?.();

0 commit comments

Comments
 (0)