tinymist_std::fs::paths

Function temp_dir_in

Source
pub fn temp_dir_in<P: AsRef<Path>, T>(
    path: P,
    f: impl FnOnce(&Path) -> Result<T>,
) -> Result<T>
Expand description

Creates a temporary directory in the given path and calls the given function.

The temporary directory is automatically destroyed after the function returns, even if it panics.

Note: it may leak if the process is killed.