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:
6
activate
6
activate
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user