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

Disable error message when Remove-Item target does not exist in pwsh #3665

Closed
NavyD opened this issue Dec 18, 2024 · 0 comments · Fixed by #3713
Closed

Disable error message when Remove-Item target does not exist in pwsh #3665

NavyD opened this issue Dec 18, 2024 · 0 comments · Fixed by #3713
Labels

Comments

@NavyD
Copy link
Contributor

NavyD commented Dec 18, 2024

Describe the bug

Using Remove-Item to remove non-existing environment variables in powershell displays an error message, e.g. trying to remove a non-existing variable when using mise deactivate will result in an error message

# mise deactivate
Remove-Item: 
Line |
   7 |  Remove-Item -Path Env:/__MISE_WATCH
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path 'Env:\__MISE_WATCH' because it does not exist.

To Reproduce

Invoke-Expression (& { (mise activate pwsh | Out-String) })
mise deactivate

Expected behavior

This type of error message should be avoided by using Remove-Item -ErrorAction SilentlyContinue -Path xxx consistent with the unset behavior in bash/zsh

mise doctor output

n/a

Additional context

@NavyD NavyD added the bug label Dec 18, 2024
jdx added a commit that referenced this issue Dec 19, 2024
jdx added a commit that referenced this issue Dec 19, 2024
@jdx jdx closed this as completed in #3713 Dec 19, 2024
jdx added a commit that referenced this issue Dec 19, 2024
miguelmig pushed a commit to miguelmig/mise that referenced this issue Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant