From 7a8870f070e32b0c6e0937dced206045dfa230ae Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Fri, 23 May 2025 15:25:01 +0800 Subject: [PATCH] fix: ensure correct PATH assignment in shell environment - Updated the environment variable initialization to use a consistent type. - Added logic to set the PATH variable correctly, ensuring it falls back to existing values if necessary. --- src/main/services/mcp/shell-env.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/services/mcp/shell-env.ts b/src/main/services/mcp/shell-env.ts index 9901417024..a4128b3651 100644 --- a/src/main/services/mcp/shell-env.ts +++ b/src/main/services/mcp/shell-env.ts @@ -85,7 +85,7 @@ function getLoginShellEnvironment(): Promise> { Logger.warn(`Shell process stderr output (even with exit code 0):\n${errorOutput.trim()}`) } - const env = {} + const env: Record = {} const lines = output.split('\n') lines.forEach((line) => { @@ -110,6 +110,8 @@ function getLoginShellEnvironment(): Promise> { Logger.warn('Raw output from shell:\n', output) } + env.PATH = env.Path || env.PATH || '' + resolve(env) }) })