Problem
The current implementation in tests/steps/process_steps.rs uses NamedTempFile::persist() which overwrites existing files without explicit control. This poses a potential safety risk and doesn't align with best practices for file handling.
Location
- File:
tests/steps/process_steps.rs
- Lines: 73-74 (in the
run() function)
Suggested Solutions
-
Use fs::write for explicit file writing:
drop(file);
std::fs::write(&manifest_path, &manifest_content)
.expect("Failed to write manifest file");
-
Use persist_noclobber to avoid overwriting:
file.persist_noclobber(&manifest_path)
.expect("Failed to persist manifest file");
Context
This issue was identified during code review of PR #56, where the focus was on improving manifest path handling in process tests.
References
Problem
The current implementation in
tests/steps/process_steps.rsusesNamedTempFile::persist()which overwrites existing files without explicit control. This poses a potential safety risk and doesn't align with best practices for file handling.Location
tests/steps/process_steps.rsrun()function)Suggested Solutions
Use
fs::writefor explicit file writing:Use
persist_noclobberto avoid overwriting:Context
This issue was identified during code review of PR #56, where the focus was on improving manifest path handling in process tests.
References