Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix crash when trashing all untracked files (#60235)

Marco Groot442a3476bcaf
diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs
index 59fe449b185..746c45d9f82 100644
--- a/crates/fs/src/fs.rs
+++ b/crates/fs/src/fs.rs
@@ -807,15 +807,8 @@ impl Fs for RealFs {
// its target and leave the link behind.
let path = std::path::absolute(path).context("Could not make the path absolute")?;
- let (tx, rx) = futures::channel::oneshot::channel();
- std::thread::Builder::new()
- .name("trash file or dir".to_string())
- .spawn(|| tx.send(trash::delete_with_info(path)))
- .expect("The os can spawn threads");
-
- Ok(rx
+ Ok(smol::unblock(move || trash::delete_with_info(path))
.await
- .context("Tx dropped or fs.restore panicked")?
.context("Could not trash file or dir")?
.into())
}