File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -320,20 +320,24 @@ fn main() {
320320 let ( build_tx, build_rx) = unbounded :: < Msg > ( ) ;
321321
322322 Parallel :: new ( )
323+ // Spawn file watchers
323324 . each ( watch_paths, |path| {
324325 info ! ( "Watching {path:} for changes..." ) ;
325- ex. spawn ( async {
326- async_watch ( path, change_tx) . await . unwrap ( ) ;
327- } )
328- . detach ( ) ;
326+ future:: block_on ( async {
327+ async_watch ( path, change_tx)
328+ . await
329+ . expect ( "Async watcher error" ) ;
330+ } ) ;
329331 } )
332+ // Spawn message Bus
330333 . add ( || {
331334 let mut building = false ;
332335 loop {
333336 match future:: block_on ( futures_lite:: future:: race (
334337 change_rx. recv ( ) ,
335338 build_rx. recv ( ) ,
336339 ) ) {
340+ // On file change, spawn a build task
337341 Ok ( Msg :: Change ) => {
338342 if !building {
339343 building = true ;
@@ -353,6 +357,7 @@ fn main() {
353357 . detach ( ) ;
354358 }
355359 }
360+ // On build complete, spawn a handle_compile_result task
356361 Ok ( Msg :: Build ( result) ) => {
357362 if let Ok ( result) = result {
358363 let output_path = args. output_path . clone ( ) ;
@@ -371,6 +376,7 @@ fn main() {
371376 }
372377 }
373378 } )
379+ // Run executor on main thread
374380 . finish ( || loop {
375381 future:: block_on ( ex. tick ( ) )
376382 } ) ;
You can’t perform that action at this time.
0 commit comments