You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A common use for TempFile is to get a unique path where a file can be created, modified and removed.
The current approach to this:
let file = TempFile::new();let path = file.as_path();drop(file);// Use the path
This is awkward and introduces a race condition in that another call to mkstemp in another test after this test deletes the file could return the same path.
it would be useful to offer a better mechanism to support this.
The text was updated successfully, but these errors were encountered:
Hmm, interesting, I was thinking that creating a file should be more of a rare pattern, and typically you would work with references. I was expecting this pattern to only be used in things like main.rs. What is the functionality for which this is used?
A common use for
TempFile
is to get a unique path where a file can be created, modified and removed.The current approach to this:
This is awkward and introduces a race condition in that another call to
mkstemp
in another test after this test deletes the file could return the same path.it would be useful to offer a better mechanism to support this.
The text was updated successfully, but these errors were encountered: