Skip to content

envars: skip Prepend when value is already at front of list#561

Open
stuartwdouglas wants to merge 1 commit intocashapp:masterfrom
stuartwdouglas:sdouglas/envars-prepend-fix
Open

envars: skip Prepend when value is already at front of list#561
stuartwdouglas wants to merge 1 commit intocashapp:masterfrom
stuartwdouglas:sdouglas/envars-prepend-fix

Conversation

@stuartwdouglas
Copy link
Copy Markdown
Contributor

When Prepend.Apply() is called and the value's path components are already a prefix of the current list, skip the operation entirely. This prevents hermit exec from reordering PATH entries that were intentionally placed before Hermit-managed paths by the caller.

Previously, hermit exec unconditionally removed and re-prepended all Hermit-managed paths, which pushed non-Hermit entries (like wrapper script directories) behind Hermit paths even when the caller had already set up the correct PATH order.

The hermit_on_activate shell hook exists to fix this reordering, but it only runs in interactive shells — not during hermit exec via bin stubs.

When Prepend.Apply() is called and the value's path components are
already a prefix of the current list, skip the operation entirely.
This prevents hermit exec from reordering PATH entries that were
intentionally placed before Hermit-managed paths by the caller.

Previously, hermit exec unconditionally removed and re-prepended
all Hermit-managed paths, which pushed non-Hermit entries (like
wrapper script directories) behind Hermit paths even when the
caller had already set up the correct PATH order.

The hermit_on_activate shell hook exists to fix this reordering,
but it only runs in interactive shells — not during hermit exec
via bin stubs.

Co-authored-by: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant