MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / cleanup_on_error

Function cleanup_on_error

atomic-cli/src/commands/clone/helpers.rs:666–670  ·  view source on GitHub ↗

Clean up a directory on error (e.g., failed clone). Silently removes the directory and all its contents. Does nothing if the path doesn't exist. # Arguments `path` - The directory to remove

(path: &Path)

Source from the content-addressed store, hash-verified

664///
665/// * `path` - The directory to remove
666pub fn cleanup_on_error(path: &Path) {
667 if path.exists() {
668 let _ = std::fs::remove_dir_all(path);
669 }
670}
671
672pub fn format_bytes(bytes: u64) -> String {
673 const KB: u64 = 1024;

Callers 2

test_cleanup_on_errorFunction · 0.85

Calls 1

existsMethod · 0.45

Tested by 2

test_cleanup_on_errorFunction · 0.68