rust-cli / rust-cli/human-panic
Custom path to save a panic report
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.9k
- Forks
- 65
- Avg merge
- 2h 48m
- Merged PRs (30d)
- 3
Description
Currently Report::persist uses env::temp_dir() to get a base folder to save a panic report
/// Write a file to disk.
pub fn persist(&self) -> Result<PathBuf, Box<dyn Error + 'static>> {
let uuid = Uuid::new_v4().hyphenated().to_string();
let tmp_dir = env::temp_dir();
let file_name = format!("report-{}.toml", &uuid);
let file_path = Path::new(&tmp_dir).join(file_name);
let toml = self.serialize().expect("only using toml-compatible types");
std::fs::write(&file_path, toml.as_bytes())?;
Ok(file_path)
}
However on some platforms TMPDIR may not be defined or be RO (yes, weird but true) . Sure TMPDIR may be overwritten when starting application however it would be nice to configure a base dir either as a parameter to ::handle_dump (breaking change) of through Metadata object
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Report::persist and the ::handle_dump and Metadata entry points mentioned in the issue to understand where the report directory is selected. Decide how the base directory should be configured, then verify that a report can be written to the configured location while preserving the existing default behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100