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

Function cleanup_on_error

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

504///
505/// * `path` - The directory to remove
506pub fn cleanup_on_error(path: &Path) {
507 if path.exists() {
508 let _ = std::fs::remove_dir_all(path);
509 }
510}
511
512pub fn format_bytes(bytes: u64) -> String {
513 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