Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay settor invocation at startup #130

Merged
merged 4 commits into from
Oct 31, 2024
Merged

Delay settor invocation at startup #130

merged 4 commits into from
Oct 31, 2024

Conversation

jpco
Copy link
Collaborator

@jpco jpco commented Oct 17, 2024

This is a relatively simple change that addresses #127. It implements the suggestion in the mailing list here: http://wryun.github.io/es-shell/mail-archive/msg00837.html

As discussed in #127, settor functions on startup still have some pitfalls with this change. Unfortunately, there's probably no perfect way to invoke settors on startup; the zero-flake fix would be to avoid running settors on startup at all, and instead establish some kind of %init hook function on startup that can implement the same behavior in a more deterministic way. But that's a backwards-incompatible change that requires some real design consideration. This change makes things at least somewhat better without any breaking changes or novel design work required. (Concretely, it fixes the ability to define a cdpath/CDPATH pair the same way as path/PATH and have it work in subshells, which is part of what I am adding in #123.)

We also sort the imported vector before scanning it for settor functions, which should also help de-flake settor function semantics despite any environment reordering. At first I thought this would be unnecessary, but looking closer it seems like a lot of shells like to cook up a different sort order for their exported environment.

Here we also default the capacity of the various vectors doing environment import to 40 elements, rather than 10.

jpco added 2 commits October 16, 2024 20:25
This keeps settor function semantics consistent despite environment reorderings.
@jpco jpco mentioned this pull request Oct 18, 2024
@jpco jpco merged commit e181bbf into wryun:master Oct 31, 2024
1 check passed
@jpco jpco deleted the settor branch October 31, 2024 23:09
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