mirror of
https://github.com/stablyai/orca.git
synced 2026-11-14 01:47:24 +00:00
fix(shell): keep a user's claude/codex function when the cwd has a matching entry (#39820)
command -v prints a shell function's bare name, so a claude/codex directory or executable in the cwd passed the -x check and Orca replaced the user's function. Skip the wrapper when a function with that name is already defined. STA-13246
This commit is contained in:
@@ -34,7 +34,8 @@ export function getPosixCodexShellLaunchPreflight(): string {
|
||||
# Why || : twice — zsh alone aborts inside the substitution, but every shell's
|
||||
# assignment adopts its exit status, so an absent codex trips set -e in bash too.
|
||||
__orca_codex_binary="$(unalias codex 2>/dev/null || :; command -v codex 2>/dev/null || :)"
|
||||
if [[ -n "\${__orca_codex_binary:-}" && -x "\${__orca_codex_binary}" ]]; then
|
||||
# Why typeset -f: a user's own codex function wins; command -v prints its bare name, which -x tests against the cwd.
|
||||
if ! typeset -f codex >/dev/null 2>&1 && [[ -n "\${__orca_codex_binary:-}" && -x "\${__orca_codex_binary}" ]]; then
|
||||
# Why the function reserved word: it suppresses alias expansion of the name,
|
||||
# which otherwise rewrites this header at parse time and aborts the whole file.
|
||||
function codex {
|
||||
|
||||
Reference in New Issue
Block a user