Ensure that fs watches are dropped when dropping the event stream
This commit is contained in:
@@ -226,11 +226,13 @@ impl Fs for RealFs {
|
|||||||
) -> Pin<Box<dyn Send + Stream<Item = Vec<fsevent::Event>>>> {
|
) -> Pin<Box<dyn Send + Stream<Item = Vec<fsevent::Event>>>> {
|
||||||
let (tx, rx) = smol::channel::unbounded();
|
let (tx, rx) = smol::channel::unbounded();
|
||||||
let (stream, handle) = EventStream::new(&[path], latency);
|
let (stream, handle) = EventStream::new(&[path], latency);
|
||||||
std::mem::forget(handle);
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
stream.run(move |events| smol::block_on(tx.send(events)).is_ok());
|
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 {
|
fn is_fake(&self) -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user