diff options
| author | Urgau <3616612+Urgau@users.noreply.github.com> | 2025-02-09 00:37:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-09 00:37:26 +0100 |
| commit | 34182470ebbc0c8fd67f09c7902b3bd44f4abbe5 (patch) | |
| tree | 7d939978e6272a27d5e64358662e8176c5725a45 /library/std/tests | |
| parent | 73bf7947e9ab731bf2764db219cd9cda216a3aed (diff) | |
| parent | 962ebf0a48436445cf300efc0fa552044f4ca19d (diff) | |
Rollup merge of #134679 - ChrisDenton:rm-readonly, r=Mark-Simulacrum
Windows: remove readonly files When calling `remove_file`, we shouldn't fail to delete readonly files. As the test makes clear, this make the Windows behaviour consistent with other platforms. This also makes us internally consistent with `remove_dir_all`. try-job: x86_64-msvc-ext1
Diffstat (limited to 'library/std/tests')
| -rw-r--r-- | library/std/tests/win_delete_self.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/std/tests/win_delete_self.rs b/library/std/tests/win_delete_self.rs new file mode 100644 index 00000000000..1c3ce4d710c --- /dev/null +++ b/library/std/tests/win_delete_self.rs @@ -0,0 +1,8 @@ +#![cfg(windows)] + +/// Attempting to delete a running binary should return an error on Windows. +#[test] +fn win_delete_self() { + let path = std::env::current_exe().unwrap(); + assert!(std::fs::remove_file(path).is_err()); +} |
