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

Function cleanup_on_error

atomic-cli/src/commands/clone/helpers.rs:647–651  ·  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

645///
646/// * `path` - The directory to remove
647pub fn cleanup_on_error(path: &Path) {
648 if path.exists() {
649 let _ = std::fs::remove_dir_all(path);
650 }
651}
652
653pub fn format_bytes(bytes: u64) -> String {
654 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