fix(activate): key the re-source guard on the deactivate function, not the inherited sentinel

Child shells inherit __HERMES_ACTIVATED from an activated parent but never
the deactivate function, so sourcing there hit 'deactivate: command not
found' and snapshotted an already-activated PATH as the restore baseline.
Matches activate.ps1's Test-Path function:deactivate.
This commit is contained in:
ethernet
2026-09-21 10:55:38 -04:00
parent 4887ae4a66
commit 02e34712d2

View File

@@ -23,8 +23,10 @@ if ! (
fi
# Guard against double-sourcing: venv activate precedent (re-activating is a
# no-op re-save; we keep it idempotent by deactivating first).
if [ -n "${__HERMES_ACTIVATED:-}" ]; then
# no-op re-save; we keep it idempotent by deactivating first). Key on the
# function, not the sentinel: child shells inherit __HERMES_ACTIVATED from an
# activated parent but never the function, and there is nothing to undo there.
if [ "$(type -t deactivate 2>/dev/null)" = "function" ]; then
deactivate
fi