Skip to content
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

Use unique path for cppwinrt temp file #3455

Merged
merged 1 commit into from
Jan 17, 2025
Merged

Use unique path for cppwinrt temp file #3455

merged 1 commit into from
Jan 17, 2025

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