Delay settor invocation at startup #130
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 acdpath
/CDPATH
pair the same way aspath
/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.