hermes-agent/apps/desktop/electron/windows-msys-bash-env.ts
islam 0f6554792f fix(desktop): set MSYS path-conversion guards in embedded terminal
Git Bash/MSYS rewrites slash-prefixed native flags such as tasklist /FI into bogus paths. Apply the same MSYS_NO_PATHCONV and MSYS2_ARG_CONV_EXCL setdefault defaults the Python terminal_tool already ships, in the Desktop PTY env.

Fixes #101826
2026-09-29 19:13:25 -05:00

20 lines
561 B
TypeScript

// Git Bash/MSYS rewrite slash-prefixed native flags (`/FI`) into paths.
// Set these two opt-outs on Windows unless already present.
export function applyWindowsMsysBashEnvDefaults(
env: NodeJS.ProcessEnv,
isWindows: boolean = process.platform === 'win32'
): NodeJS.ProcessEnv {
if (!isWindows) {
return env
}
if (!Object.prototype.hasOwnProperty.call(env, 'MSYS_NO_PATHCONV')) {
env.MSYS_NO_PATHCONV = '1'
}
if (!Object.prototype.hasOwnProperty.call(env, 'MSYS2_ARG_CONV_EXCL')) {
env.MSYS2_ARG_CONV_EXCL = '*'
}
return env
}