mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-22 21:55:15 +00:00
Fix broken file watcher implementation
This one took a little bit of tracking down; the VfsWatcher used to spawn a new thread and then stall/park forever. With one of the recent changes to get rid of the extra thread, VfsWatcher started getting dropped, which in turn dropped the watchers created by the notify crate. Because the threads only tie back to the VfsWatcher was a cloned Arc<Mutex<VfsSession>>, everything was fine, except that their mpsc::Receiver objects were no longer receiving events. This manifested itself as the file watcher magically not watching any files. Oops.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::process;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::thread;
|
||||
|
||||
use rand;
|
||||
|
||||
@@ -87,6 +88,12 @@ pub fn serve(project_path: &PathBuf, verbose: bool, port: Option<u64>) {
|
||||
|
||||
println!("Server listening on port {}", web_config.port);
|
||||
|
||||
VfsWatcher::new(vfs.clone()).start();
|
||||
{
|
||||
let vfs = vfs.clone();
|
||||
thread::spawn(move || {
|
||||
VfsWatcher::new(vfs).start();
|
||||
});
|
||||
}
|
||||
|
||||
web::start(web_config, project.clone(), &PLUGIN_CHAIN, vfs.clone());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user