Skip to content

Extend TempFile #202

@JonathanWoollett-Light

Description

@JonathanWoollett-Light

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions