Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
node: use `TempDir::close` in clone
Archived fintohaps opened 1 year ago

It was reported that on WSL after dropping TempDir there are still open file handles.

Attempt to close the TempDir and any open file handles, if possible – logging the error, if any.

1 file changed +7 -0 6ab3bfcb 1f0d2ce1
modified radicle-node/src/worker/fetch.rs
@@ -186,6 +186,13 @@ fn mv(tmp: tempfile::TempDir, storage: &Storage, rid: &RepoId) -> Result<(), err
        .into());
    }

+
    // N.b. Attempt to explicitly close the `TempDir`, since open file handles
+
    // causes issues on WSL
+
    let path = tmp.path().to_path_buf();
+
    if let Err(e) = tmp.close() {
+
        log::warn!(target: "worker", "Failed to cleanup temporary repository path {:?}: {e}", path);
+
    }
+

    Ok(())
}