Skip to content

Replace NamedTempFile::persist() with safer alternatives in process tests #58

@coderabbitai

Description

@coderabbitai

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

  1. Use fs::write for explicit file writing:

    drop(file);
    std::fs::write(&manifest_path, &manifest_content)
        .expect("Failed to write manifest file");
  2. 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

Metadata

Metadata

Assignees

Labels

mediumCould be disruptive, but might not happen

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions