fix(windows): hide terminal windows when spawning child processes
This commit is contained in:
@@ -6,6 +6,15 @@
|
||||
* See src/services/worker/README.md for architecture details.
|
||||
*/
|
||||
|
||||
// Windows terminal window fix: Set process.type to trick MCP SDK into enabling windowsHide
|
||||
// The SDK checks `process.type === 'renderer'` (Electron detection) before setting windowsHide.
|
||||
// By setting process.type, the SDK's isElectron() check becomes truthy on Windows, hiding
|
||||
// terminal windows when spawning uvx/python processes for Chroma MCP server.
|
||||
// The type is sometimes not present resulting in the check being false. Setting it like this fixes it
|
||||
if (process.platform === 'win32' && !process.type) {
|
||||
(process as any).type = 'renderer';
|
||||
}
|
||||
|
||||
import express from 'express';
|
||||
import http from 'http';
|
||||
import path from 'path';
|
||||
|
||||
@@ -36,7 +36,8 @@ function execGit(command: string): string {
|
||||
return execSync(`git ${command}`, {
|
||||
cwd: INSTALLED_PLUGIN_PATH,
|
||||
encoding: 'utf-8',
|
||||
timeout: 30000
|
||||
timeout: 30000,
|
||||
windowsHide: true
|
||||
}).trim();
|
||||
}
|
||||
|
||||
@@ -47,7 +48,8 @@ function execShell(command: string, timeoutMs: number = 60000): string {
|
||||
return execSync(command, {
|
||||
cwd: INSTALLED_PLUGIN_PATH,
|
||||
encoding: 'utf-8',
|
||||
timeout: timeoutMs
|
||||
timeout: timeoutMs,
|
||||
windowsHide: true
|
||||
}).trim();
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -89,7 +89,8 @@ export function getCurrentProjectName(): string {
|
||||
const gitRoot = execSync('git rev-parse --show-toplevel', {
|
||||
cwd: process.cwd(),
|
||||
encoding: 'utf8',
|
||||
stdio: ['pipe', 'pipe', 'ignore']
|
||||
stdio: ['pipe', 'pipe', 'ignore'],
|
||||
windowsHide: true
|
||||
}).trim();
|
||||
return basename(gitRoot);
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user