Skip to content

Conversation

jakepetroules
Copy link
Contributor

Because _exit immediately terminates the process, the CloseHandle calls in the defer blocks in the body of the exec function are never called. This leads to the handles leaking on Windows. Move the body of the function into a do block above the _exit call to resolve this.

@bkhouri
Copy link

bkhouri commented Apr 16, 2025

@swift-ci test

1 similar comment
@jakepetroules
Copy link
Contributor Author

@swift-ci test

@jakepetroules jakepetroules enabled auto-merge (rebase) April 16, 2025 19:37
Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Because _exit immediately terminates the process, the CloseHandle calls in the defer blocks in the body of the exec function are never called. This leads to the handles leaking on Windows. Move the body of the function into a do block above the _exit call to resolve this.
@jakepetroules
Copy link
Contributor Author

@swift-ci test

@bkhouri
Copy link

bkhouri commented Apr 17, 2025

@swift-ci test windows

@jakepetroules jakepetroules merged commit e8fbc8b into main Apr 17, 2025
3 checks passed
@jakepetroules jakepetroules deleted the windows-handle-leak branch April 17, 2025 18: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.

4 participants