Skip to content

Commit 674e79f

Browse files
committed
match mcp spec and python
1 parent 62aa115 commit 674e79f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/client/stdio.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,22 +219,21 @@ export class StdioClientTransport implements Transport {
219219
});
220220
});
221221

222+
try {
223+
processToClose.stdin?.end();
224+
} catch {
225+
// ignore
226+
}
227+
222228
this._abortController.abort();
223229

224-
// waits the underlying process to exit cleanly otherwise after 1s kills it
225-
await Promise.race([closePromise, new Promise(resolve => setTimeout(resolve, 1_000).unref())]);
230+
await Promise.race([closePromise, new Promise(resolve => setTimeout(resolve, 2_000).unref())]);
226231

227232
if (processToClose.exitCode === null) {
228-
try {
229-
processToClose.stdin?.end();
230-
} catch {
231-
// ignore errors in trying to close stdin
232-
}
233-
234233
try {
235234
processToClose.kill('SIGKILL');
236235
} catch {
237-
// we did our best
236+
// ignore
238237
}
239238
}
240239
}

0 commit comments

Comments
 (0)