KEMBAR78
Use unique path for `cppwinrt` temp file by kennykerr · Pull Request #3455 · microsoft/windows-rs · GitHub
Skip to content

Conversation

@kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Jan 17, 2025

This is not a problem consumers will face but my CI tests occasionally fail on windows-rs due to tests running in parallel as there's IO contention on the temp file. This update just ensures that each invocation gets a unique file name so there's no contention. Ideally there'd be a simpler way to produce a unique path but I can't think of any but this is simple enough.

I had previously attempted to alleviate the issue in #3289 but there was still a race as two different tests could race to create the file and then subsequently write the file. Here we just avoid the race entirely.

@riverar
Copy link
Collaborator

riverar commented Jan 17, 2025

Could also defer to Win32 API GetTempFileName.

@kennykerr kennykerr merged commit 7172cec into master Jan 17, 2025
78 checks passed
@kennykerr kennykerr deleted the unique-cppwinrt branch January 17, 2025 13:18
@kennykerr
Copy link
Collaborator Author

That would definitely be more difficult and unsafe. 🫢

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