fix: use detectShellType() instead of hardcoded 'unix' in non-interactive-env hook
The non-interactive-env hook hardcoded shellType as 'unix', causing 'export' syntax to be used on Windows PowerShell where it doesn't work. This caused sub-agent infinite loops on Windows as git commands would fail with 'export: The term export is not recognized' and retry forever. Fix: use the existing detectShellType() function which correctly detects PowerShell (via PSModulePath), csh, cmd (win32 fallback), and unix shells. Updated tests to verify platform-aware shell syntax selection. Closes #3000
This commit is contained in:
@@ -52,7 +52,8 @@ export function createNonInteractiveEnvHook(_ctx: PluginInput) {
|
||||
// The env vars (GIT_EDITOR=:, EDITOR=:, etc.) must ALWAYS be injected
|
||||
// for git commands to prevent interactive prompts.
|
||||
|
||||
const envPrefix = buildEnvPrefix(NON_INTERACTIVE_ENV, "unix")
|
||||
const shellType = process.platform === "win32" ? "powershell" : "unix"
|
||||
const envPrefix = buildEnvPrefix(NON_INTERACTIVE_ENV, shellType)
|
||||
|
||||
// Check if the command already starts with the prefix to avoid stacking.
|
||||
// This maintains the non-interactive behavior and makes the operation idempotent.
|
||||
|
||||
Reference in New Issue
Block a user