Skip to content

Conversation

brianmichel
Copy link
Contributor

When we invoke the script block it could throw an exception so we should wrap it in a try finally block to ensure that we can restore the old environment variables, otherwise you can end up back in a shell that has an incorrect set of variables set.

This is most noticable if an exception is thrown when entering the vs dev shell since without resetting the old vars you will have invalid Visual Studio env variables set meaning you need to manually reset your shell environment.

When we invoke the script block it could throw an exception so we should
wrap it in a try finally block to ensure that we can restore the old
environment variables, otherwise you can end up back in a shell that has
an incorrect set of variables set.

This is most noticable if an exception is thrown when entering the vs
dev shell since without resetting the old vars you will have invalid
Visual Studio env variables set meaning you need to manually reset your
shell environment.
@brianmichel
Copy link
Contributor Author

cc @compnerd

@compnerd
Copy link
Member

compnerd commented Apr 7, 2025

@swift-ci please smoke test

@compnerd compnerd enabled auto-merge April 7, 2025 20:54
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
auto-merge was automatically disabled April 7, 2025 21:01

Head branch was pushed to by a user without write access

@compnerd
Copy link
Member

compnerd commented Apr 7, 2025

@swift-ci please smoke test

@compnerd compnerd enabled auto-merge April 7, 2025 21:39
@compnerd compnerd merged commit b33be25 into swiftlang:main Apr 8, 2025
3 checks passed
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.

2 participants