Skip to content

Builder option to avoid cleanup on Drop #122

@Mark-Simulacrum

Description

@Mark-Simulacrum

rustc has a -Csave-temps option that is intended for debugging (or other cases where temporary file access is useful).

We used to have code like this, but it behaved incorrectly in the presence of panics in the intermediary code. It would be nice to have a boolean flag on the builder that would let us do something like .cleanup(opts.save_temps) and that would create a TempDir which doesn't delete itself on Drop.

For now we've implemented this in rustc itself atop TempDir, but upstreaming it would be more convenient API wise.

let tmpdir = ...;

// a bunch of code runs, using tmpdir

if opts.save_temps {
    let _ = tmpdir.into_path();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions