run_make_support::scoped_run

Function run_in_tmpdir

Source
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:

  1. Creates a temporary directory (tmpdir)
  2. Copies all files from the current directory to tmpdir
  3. Changes the current working directory to tmpdir
  4. Calls callback
  5. Switches working directory back to the original one
  6. Removes tmpdir