Ensure test file is cleaned up in cwd_is_writable test case

This commit is contained in:
2026-03-20 18:52:03 +01:00
parent bf53d92d49
commit ba885b7dd6

View File

@@ -9,8 +9,18 @@ fn sandbox(extra_args: &[&str]) -> Command {
cmd cmd
} }
struct CleanupFile(&'static str);
impl Drop for CleanupFile {
fn drop(&mut self) {
let _ = fs::remove_file(self.0);
}
}
#[test] #[test]
fn cwd_is_writable() { fn cwd_is_writable() {
let _cleanup = CleanupFile("./sandbox_canary");
let output = sandbox(&[]) let output = sandbox(&[])
.args(["--", "bash", "-c", "touch ./sandbox_canary && echo ok"]) .args(["--", "bash", "-c", "touch ./sandbox_canary && echo ok"])
.output() .output()