feat: improve stdio test Windows compatibility and refactor command logic
This commit is contained in:
parent
60310e9478
commit
a7dc125850
2 changed files with 11 additions and 4 deletions
|
|
@ -1,9 +1,7 @@
|
|||
import { JSONRPCMessage } from "../types.js";
|
||||
import { StdioClientTransport, StdioServerParameters } from "./stdio.js";
|
||||
import { StdioClientTransport, getDefaultServerParameters } from "./stdio.js";
|
||||
|
||||
const serverParameters: StdioServerParameters = {
|
||||
command: "/usr/bin/tee",
|
||||
};
|
||||
const serverParameters = getDefaultServerParameters();
|
||||
|
||||
test("should start then close cleanly", async () => {
|
||||
const client = new StdioClientTransport(serverParameters);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,15 @@ export type StdioServerParameters = {
|
|||
cwd?: string;
|
||||
};
|
||||
|
||||
// Configure default server parameters based on OS
|
||||
// Uses 'more' command for Windows and 'tee' command for Unix/Linux
|
||||
export const getDefaultServerParameters = (): StdioServerParameters => {
|
||||
if (process.platform === "win32") {
|
||||
return { command: "more" };
|
||||
}
|
||||
return { command: "/usr/bin/tee" };
|
||||
};
|
||||
|
||||
/**
|
||||
* Environment variables to inherit by default, if an environment is not explicitly given.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue