https://github.com/mendess/namespaced-tmp
https://github.com/mendess/namespaced-tmp
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mendess/namespaced-tmp
- Owner: mendess
- Created: 2022-02-23T22:15:38.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-23T22:37:24.000Z (over 3 years ago)
- Last Synced: 2025-02-08T22:46:28.380Z (4 months ago)
- Language: Rust
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Create namespaced tmp files
Sometimes you want to run multiple instances of a program and have it not
conflict with other instances of the same program. And sometimes these programs
use the `/tmp` directory and then it's all sad times all around.This crate let's you easily namespace your tmp files, and also creates the
base dir for you!```rust
use namespaced_tmp::blocking::in_tmp;
use std::io;fn main() -> io::Result<()> {
let (path, e) = in_tmp("namespace", "file");
if let Some(e) = e {
return Err(e);
}
assert!(path.parent().unwrap().is_dir());
assert!(!path.exists());
std::fs::remove_dir(path.parent().unwrap())?;
Ok(())
}
```