From c8d32035e8c240dd8f7b4c8ac3f00d2aa39a68ff Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 26 Dec 2025 08:41:53 +0000 Subject: [PATCH 1/3] Initial plan From 286d93f10d5f9b8fcf35d3ed4ccfbc8282954a00 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 26 Dec 2025 08:47:50 +0000 Subject: [PATCH 2/3] Fix GOPATH in tmux by checking PID mismatch in bash and zsh hooks Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com> --- internal/shell/bash.go | 40 +++++++++++++++++++++------------------- internal/shell/zsh.go | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/internal/shell/bash.go b/internal/shell/bash.go index b3909de7..e7228725 100644 --- a/internal/shell/bash.go +++ b/internal/shell/bash.go @@ -24,27 +24,29 @@ import ( // Based on https://github.com/direnv/direnv/blob/master/internal/cmd/shell_bash.go const bashHook = ` -{{.EnvContent}} - -export __VFOX_PID=$$; -export __VFOX_SHELL='bash'; - -_vfox_hook() { - local previous_exit_status=$?; - trap -- '' SIGINT; - eval "$("{{.SelfPath}}" env -s bash)"; - trap - SIGINT; - return $previous_exit_status; -}; -if ! [[ "${PROMPT_COMMAND[*]:-}" =~ _vfox_hook ]]; then - if [[ "$(declare -p PROMPT_COMMAND 2>&1)" == "declare -a"* ]]; then - PROMPT_COMMAND=(_vfox_hook "${PROMPT_COMMAND[@]}") - else - PROMPT_COMMAND="_vfox_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}" +if [[ -z "$__VFOX_PID" || "$__VFOX_PID" != "$$" ]]; then + {{.EnvContent}} + + export __VFOX_PID=$$; + export __VFOX_SHELL='bash'; + + _vfox_hook() { + local previous_exit_status=$?; + trap -- '' SIGINT; + eval "$("{{.SelfPath}}" env -s bash)"; + trap - SIGINT; + return $previous_exit_status; + }; + if ! [[ "${PROMPT_COMMAND[*]:-}" =~ _vfox_hook ]]; then + if [[ "$(declare -p PROMPT_COMMAND 2>&1)" == "declare -a"* ]]; then + PROMPT_COMMAND=(_vfox_hook "${PROMPT_COMMAND[@]}") + else + PROMPT_COMMAND="_vfox_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}" + fi fi -fi -trap 'vfox env --cleanup' EXIT + trap 'vfox env --cleanup' EXIT +fi ` type bash struct{} diff --git a/internal/shell/zsh.go b/internal/shell/zsh.go index 6df35788..f32dde49 100644 --- a/internal/shell/zsh.go +++ b/internal/shell/zsh.go @@ -25,7 +25,7 @@ type zsh struct{} var Zsh = zsh{} const zshHook = ` -if [[ -z "$__VFOX_PID" || -z "$__VFOX_SHELL" ]]; then +if [[ -z "$__VFOX_PID" || "$__VFOX_PID" != "$$" ]]; then {{.EnvContent}} export __VFOX_PID=$$; From c074af0758d419e3f44dd7ba8b4c2abace755e73 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 26 Dec 2025 08:49:51 +0000 Subject: [PATCH 3/3] Add shell type check to handle shell switching correctly Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com> --- internal/shell/bash.go | 2 +- internal/shell/zsh.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/shell/bash.go b/internal/shell/bash.go index e7228725..18266dc9 100644 --- a/internal/shell/bash.go +++ b/internal/shell/bash.go @@ -24,7 +24,7 @@ import ( // Based on https://github.com/direnv/direnv/blob/master/internal/cmd/shell_bash.go const bashHook = ` -if [[ -z "$__VFOX_PID" || "$__VFOX_PID" != "$$" ]]; then +if [[ -z "$__VFOX_PID" || "$__VFOX_PID" != "$$" || "$__VFOX_SHELL" != "bash" ]]; then {{.EnvContent}} export __VFOX_PID=$$; diff --git a/internal/shell/zsh.go b/internal/shell/zsh.go index f32dde49..2d19ce34 100644 --- a/internal/shell/zsh.go +++ b/internal/shell/zsh.go @@ -25,7 +25,7 @@ type zsh struct{} var Zsh = zsh{} const zshHook = ` -if [[ -z "$__VFOX_PID" || "$__VFOX_PID" != "$$" ]]; then +if [[ -z "$__VFOX_PID" || "$__VFOX_PID" != "$$" || "$__VFOX_SHELL" != "zsh" ]]; then {{.EnvContent}} export __VFOX_PID=$$;