Skip to content

Commit

Permalink
Merge pull request #68 from modelcontextprotocol/ani/fix-npx
Browse files Browse the repository at this point in the history
Fix npx and other processes that launch subprocesses
  • Loading branch information
anaisbetts authored Nov 26, 2024
2 parents 8f89fb2 + 9fd52c8 commit d5c0e86
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/client/stdio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class StdioClientTransport implements Transport {
async start(): Promise<void> {
if (this._process) {
throw new Error(
"StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.",
"StdioClientTransport already started! If using Client class, note that connect() calls start() automatically."
);
}

Expand All @@ -113,17 +113,8 @@ export class StdioClientTransport implements Transport {
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
shell: false,
signal: this._abortController.signal,

// NB: The behavior of detached varies based on platform, and also
// is different based on whether the process is a Win32 Subsystem
// process or a Console Subsystem process. Strangely, the behavior
// of detached is almost 1:1 the opposite in Electron+Windows vs
// what is documented on the node.js website, and also is different
// based on whether you launch Electron in a development environment
// (i.e. via `electron-forge start`) vs a production environment
// (i.e. YourApp.exe).
detached: process.platform === "win32" && isElectron(),
},
windowsHide: process.platform === "win32" && isElectron(),
}
);

this._process.on("error", (error) => {
Expand Down

0 comments on commit d5c0e86

Please sign in to comment.