pub fn run_in_tmpdir<F: FnOnce()>(callback: F)
Expand description
This function is designed for running commands in a temporary directory that is cleared after the function ends.
What this function does:
- Creates a temporary directory (
tmpdir
) - Copies all files from the current directory to
tmpdir
- Changes the current working directory to
tmpdir
- Calls
callback
- Switches working directory back to the original one
- Removes
tmpdir