Skip to content

Don’t crash SourceKit-LSP if swift-format crashes while we write the source file to stdin #2098

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 1 commit into from
Mar 28, 2025

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 27, 2025

When swift-format crashes before we send all data to its stdin, we get a SIGPIPE when trying to write more data to its studio on Linux. This, in turn, takes SourceKit-LSP down.

Do the same trick that we do when launching JSONRPCConnection of disabling SIGPIPE globally if we can’t disable it for individual pipes.

rdar://147665695

@ahoppen ahoppen changed the title Don’t crash SourceKit-LSP if swift-format crashes while we write the Don’t crash SourceKit-LSP if swift-format crashes while we write the source file to stdin Mar 27, 2025
@ahoppen ahoppen marked this pull request as ready for review March 27, 2025 23:58
@ahoppen
Copy link
Member Author

ahoppen commented Mar 27, 2025

@swift-ci Please test

…source file to stdin

When swift-format crashes before we send all data to its stdin, we get a SIGPIPE when trying to write more data to its studio on Linux. This, in turn, takes SourceKit-LSP down.

Do the same trick that we do when launching `JSONRPCConnection` of disabling SIGPIPE globally if we can’t disable it for individual pipes.

rdar://147665695
@ahoppen ahoppen force-pushed the swift-format-crashing branch from 223e3ca to f3daf21 Compare March 28, 2025 04:47
@ahoppen
Copy link
Member Author

ahoppen commented Mar 28, 2025

@ahoppen
Copy link
Member Author

ahoppen commented Mar 28, 2025

swiftlang/swift-tools-support-core#502

@swift-ci Please test Windows

@ahoppen
Copy link
Member Author

ahoppen commented Mar 28, 2025

swiftlang/swift-tools-support-core#502

@swift-ci Please test Windows

@ahoppen ahoppen merged commit 254b42a into swiftlang:main Mar 28, 2025
3 checks passed
@ahoppen ahoppen deleted the swift-format-crashing branch April 7, 2025 22:39
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