Skip to content

Fix npx and other processes that launch subprocesses #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIOLI: Should this be an unconditional true now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably Yes but I wanted to be extra paranoid

}
);

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