Fix zsh and bash shell integration when using set -u#185425
Merged
Tyriar merged 4 commits intomicrosoft:mainfrom Jul 31, 2023
Merged
Fix zsh and bash shell integration when using set -u#185425Tyriar merged 4 commits intomicrosoft:mainfrom
Tyriar merged 4 commits intomicrosoft:mainfrom
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree |
Tyriar
approved these changes
Jul 29, 2023
Member
Tyriar
left a comment
There was a problem hiding this comment.
Thanks @demccormack and sorry about the delay. The change looks good, I'm not sure if it's complete even with my little change as there are a few variables that may not be set still like VSCODE_INJECTION but I'll move ahead with this and we can fix stragglers in a different PR.
bpasero
approved these changes
Jul 31, 2023
Contributor
Author
|
Thanks very much @Tyriar! I'll be using it and can open another PR if there are other variables that need the same treatment 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #185324
Some users (like me) use the
set -uakaset -o nounsetoption in their~/.bashrcor~/.zshrc. This causes shell commands to fail if there are any unset variables, which gives the user some protection against making silly mistakes. Currently, having this option set causes VS Code shell integration toThe fix is to use parameter expansion to remove the problem variables if they are unset.
This is my first PR to this repo. I don't think we can test shell scripts, but let me know if I'm wrong.