This repository has been archived by the owner on Apr 17, 2020. It is now read-only.
EXIT traps that print to stdout shouldn't break process substitution #25
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.
OS X sets a trap on
EXIT
to callshell_session_update
, this callsshell_session_save
which will print to stdout. Normally this is not a problem for subshells instantiated like$(...)
, because the traps are apparently not inherited by (at least these types of) subshells. However, rvm re-installs this trap, (even from within subshells) when you call something likecd
(which rvm overrides).Basically:
Will not have the
EXIT
trap called inside the$(...)
, and will result ina=a
. However:Will have the trap called, and will result in
a=a trapped
.The latter is what rvm ends up doing when it's loaded by its version of
cd
, and you do something like:Perhaps the overridden shell commands should never install the exit trap? Or rvm could detect when it's being run inside a subshell where it's helpers aren't needed and not run any of the init code?