-
Notifications
You must be signed in to change notification settings - Fork 458
[Macros] Termination signal for executable plugin #3164
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
base: main
Are you sure you want to change the base?
Conversation
Exit the plugin when it receives an empty message. rdar://160820381
swiftlang/swift#84829 |
// Empty message is a termination signal. | ||
if count == 0 { | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, not returning nil
is still safe. try _read(into: data)
is no-op, and JSON.decode()
would throw an Error, then the caller would exit(1)
. This change just make it graceful immediate exit(0)
swiftlang/swift#84829 |
2 similar comments
swiftlang/swift#84829 |
swiftlang/swift#84829 |
|
||
// Read the JSON payload. | ||
let count = Int(UInt64(littleEndian: header)) | ||
// Empty message is a termination signal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the compiler explicitly sending a message with header == 0
to indicate that the plugin process should exit?
Exit the plugin when it receives an empty message.
rdar://160820381