Merge pull request #284 from HoberMin/feat/improve-stdio-test-windows-compatibility

Improve stdio test Windows compatibility and refactor command logic

I've pushed updates to address my own comments - thank you @HoberMin for this contribution!
This commit is contained in:
Felix Weinberger 2025-07-08 15:32:55 +01:00 • committed by GitHub
commit 22dc79b2a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,10 +1,17 @@
import { JSONRPCMessage } from "../types.js";
import { StdioClientTransport, StdioServerParameters } from "./stdio.js";
const serverParameters: StdioServerParameters = {
command: "/usr/bin/tee",
// Configure default server parameters based on OS
// Uses 'more' command for Windows and 'tee' command for Unix/Linux
const getDefaultServerParameters = (): StdioServerParameters => {
if (process.platform === "win32") {
return { command: "more" };
}
return { command: "/usr/bin/tee" };
};
const serverParameters = getDefaultServerParameters();
test("should start then close cleanly", async () => {
const client = new StdioClientTransport(serverParameters);
client.onerror = (error) => {