Skip to content

Commit 97cac5b

Browse files
authored
Merge pull request #62 from modelcontextprotocol/ani/fix-dosbox-more
Use detached: true on Windows
2 parents 470d39f + e0c821c commit 97cac5b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/client/stdio.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,17 @@ export class StdioClientTransport implements Transport {
113113
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
114114
shell: false,
115115
signal: this._abortController.signal,
116-
},
116+
117+
// NB: The behavior of detached varies based on platform, and also
118+
// is different based on whether the process is a Win32 Subsystem
119+
// process or a Console Subsystem process. Strangely, the behavior
120+
// of detached is almost 1:1 the opposite in Electron+Windows vs
121+
// what is documented on the node.js website, and also is different
122+
// based on whether you launch Electron in a development environment
123+
// (i.e. via `electron-forge start`) vs a production environment
124+
// (i.e. YourApp.exe).
125+
detached: process.platform === "win32" && isElectron(),
126+
}
117127
);
118128

119129
this._process.on("error", (error) => {
@@ -187,3 +197,7 @@ export class StdioClientTransport implements Transport {
187197
});
188198
}
189199
}
200+
201+
function isElectron() {
202+
return "type" in process;
203+
}

0 commit comments

Comments
 (0)