Skip to content

Add shutDown method to PluginMessageHandler #2915

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

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Dec 11, 2024

This method deterministically and synchronously cleans up resources that cannot be dealt with in a deinitializer due to possible errors thrown during the clean up. Usually this includes closure of file handles, sockets, shutting down external processes and IPC resources set up for these processes, etc.

This method is required for swift-plugin-server to properly clean up file handles opened for communication with Wasm macros, as prototyped in swiftlang/swift#73031.

For the default non-Wasm macros implementations this change has no effect, since the shutDown implementation for those is empty.

This method deterministically and synchronously cleans up resources that cannot be dealt with in a deinitializer due to possible errors thrown during the clean up. Usually this includes closure of file handles, sockets, shutting down external processes and IPC resources set up for these processes, etc.

This method is required for `swift-plugin-server` to properly clean up file handles there were opened for communication with Wasm macros, as prototyped in swiftlang/swift#73031.
@MaxDesiatov MaxDesiatov added the Macros Issues in the SwiftSyntaxMacro… modules label Dec 11, 2024
@MaxDesiatov MaxDesiatov requested a review from rintaro December 11, 2024 13:15
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov
Copy link
Contributor Author

swiftlang/swift#78114

@swift-ci test

@MaxDesiatov MaxDesiatov enabled auto-merge (squash) December 11, 2024 19:00
@MaxDesiatov MaxDesiatov disabled auto-merge December 11, 2024 19:00
@MaxDesiatov MaxDesiatov merged commit b9ef683 into main Dec 12, 2024
3 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/message-handler-shutdown branch December 12, 2024 09:23
MaxDesiatov added a commit to swiftlang/swift that referenced this pull request Dec 12, 2024
Depends on swiftlang/swift-syntax#2915

The `main` method on `CompilerPluginMessageListener` can synchronously clean up resources that cannot be dealt with in a deinitializer due to possible errors thrown during the clean up. Usually this includes closure of file handles, sockets, shutting down external processes and IPC resources set up for these processes, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Macros Issues in the SwiftSyntaxMacro… modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants