summaryrefslogtreecommitdiffstats
path: root/src/test_helpers/shared/with_temporary_path.rs
blob: f0a71314a78f6d616e4972e253210e28d76d1aac (plain)
1
2
3
4
5
6
7
8
9
10
11
use std::path::Path;

use tempfile::Builder;

pub(crate) fn with_temporary_path<F>(callback: F)
where F: FnOnce(&Path) {
	let temp_repository_directory = Builder::new().prefix("interactive-rebase-tool").tempdir().unwrap();
	let path = temp_repository_directory.path();
	callback(path);
	temp_repository_directory.close().unwrap();
}