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

Reset fish shell status even if variable not exists #2509

Merged
merged 1 commit into from
Apr 29, 2023

Conversation

soraxas
Copy link
Contributor

@soraxas soraxas commented Apr 29, 2023

This is pretty straightforward, where it avoids polluting shell status with status code > 0.

Currently all the following functions activate, deactivate, reactivate, install, ... return non-zero status for me due to the variable setting in functions like

...
set -e CONDA_PREFIX
set -e CONDA_DEFAULT_ENV
set -e CONDA_PROMPT_MODIFIER
set -gx CONDA_SHLVL "0"

will return non-zero status if those variables do not exists.

Note1: set -e XXX can't erase non-existing variable, and will return non-zero status if that happens.

Note2: setting variable (e.g. set -gx CONDA_SHLVL "0") does not modify the current return status, so it doesn't reset the fail status from attempting to erase non-existing variables.


This just modify the erasing command into something like:

set -e CONDA_PREFIX || true
set -e CONDA_DEFAULT_ENV || true
set -e CONDA_PROMPT_MODIFIER || true
set -gx CONDA_SHLVL "0"

Signed-off-by: Tin Lai <oscar@tinyiu.com>
@jonashaag
Copy link
Collaborator

Thanks!

@jonashaag jonashaag merged commit 631794b into mamba-org:main Apr 29, 2023
19 checks passed
AntoinePrv pushed a commit to AntoinePrv/mamba that referenced this pull request May 3, 2023
reset fish shell status even if variable not exists

Signed-off-by: Tin Lai <oscar@tinyiu.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.

None yet

2 participants