Merge pull request #2812 from code-yeongyu/fix/non-interactive-env-win-bash-prefix
fix(non-interactive-env): force unix prefix for bash git commands
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import type { PluginInput } from "@opencode-ai/plugin"
|
import type { PluginInput } from "@opencode-ai/plugin"
|
||||||
import { HOOK_NAME, NON_INTERACTIVE_ENV, SHELL_COMMAND_PATTERNS } from "./constants"
|
import { HOOK_NAME, NON_INTERACTIVE_ENV, SHELL_COMMAND_PATTERNS } from "./constants"
|
||||||
import { log, buildEnvPrefix, detectShellType } from "../../shared"
|
import { log, buildEnvPrefix } from "../../shared"
|
||||||
|
|
||||||
export * from "./constants"
|
export * from "./constants"
|
||||||
export * from "./detector"
|
export * from "./detector"
|
||||||
@@ -52,9 +52,7 @@ export function createNonInteractiveEnvHook(_ctx: PluginInput) {
|
|||||||
// The env vars (GIT_EDITOR=:, EDITOR=:, etc.) must ALWAYS be injected
|
// The env vars (GIT_EDITOR=:, EDITOR=:, etc.) must ALWAYS be injected
|
||||||
// for git commands to prevent interactive prompts.
|
// for git commands to prevent interactive prompts.
|
||||||
|
|
||||||
// Detect the current shell type for proper env var syntax (export for bash/zsh, setenv for csh/tcsh, etc.)
|
const envPrefix = buildEnvPrefix(NON_INTERACTIVE_ENV, "unix")
|
||||||
const shellType = detectShellType()
|
|
||||||
const envPrefix = buildEnvPrefix(NON_INTERACTIVE_ENV, shellType)
|
|
||||||
|
|
||||||
// Check if the command already starts with the prefix to avoid stacking.
|
// Check if the command already starts with the prefix to avoid stacking.
|
||||||
// This maintains the non-interactive behavior and makes the operation idempotent.
|
// This maintains the non-interactive behavior and makes the operation idempotent.
|
||||||
|
|||||||
Reference in New Issue
Block a user