mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-12 19:11:23 +03:00
Ensure that fs watches are dropped when dropping the event stream
This commit is contained in:
parent
59366a5c44
commit
43613fe2ac
@ -226,11 +226,13 @@ impl Fs for RealFs {
|
||||
) -> Pin<Box<dyn Send + Stream<Item = Vec<fsevent::Event>>>> {
|
||||
let (tx, rx) = smol::channel::unbounded();
|
||||
let (stream, handle) = EventStream::new(&[path], latency);
|
||||
std::mem::forget(handle);
|
||||
std::thread::spawn(move || {
|
||||
stream.run(move |events| smol::block_on(tx.send(events)).is_ok());
|
||||
});
|
||||
Box::pin(rx)
|
||||
Box::pin(rx.chain(futures::stream::once(async move {
|
||||
drop(handle);
|
||||
vec![]
|
||||
})))
|
||||
}
|
||||
|
||||
fn is_fake(&self) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user