Skip to content

Commit

Permalink
fixed shred -u for windows
Browse files Browse the repository at this point in the history
fixed shred panic on windows
  • Loading branch information
Statheres committed Jun 18, 2023
1 parent ea532d1 commit 7306be6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/uu/shred/src/shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,9 @@ fn wipe_name(orig_path: &Path, verbose: bool) -> Option<PathBuf> {
}

// Sync every file rename
let new_file = File::open(new_path.clone())
let new_file = OpenOptions::new()
.write(true)
.open(new_path.clone())
.expect("Failed to open renamed file for syncing");
new_file.sync_all().expect("Failed to sync renamed file");

Expand Down
2 changes: 1 addition & 1 deletion tests/by-util/test_shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn test_shred_remove() {
at.touch(file_b);

// Shred file_a.
scene.ucmd().arg("-u").arg(file_a).run();
scene.ucmd().arg("-u").arg(file_a).succeeds();

// file_a was deleted, file_b exists.
assert!(!at.file_exists(file_a));
Expand Down

0 comments on commit 7306be6

Please sign in to comment.