@@ -54,9 +54,10 @@ async fn async_watch(
5454 after_build : Option < String > ,
5555 create_sourcedirs : bool ,
5656 build_dev_deps : bool ,
57+ bsc_path : Option < String > ,
5758) -> notify:: Result < ( ) > {
58- let mut build_state =
59- build :: initialize_build ( None , filter , show_progress , path , None ) . expect ( "Can't initialize build" ) ;
59+ let mut build_state = build :: initialize_build ( None , filter , show_progress , path , bsc_path . clone ( ) )
60+ . expect ( "Can't initialize build" ) ;
6061 let mut needs_compile_type = CompileType :: Incremental ;
6162 // create a mutex to capture if ctrl-c was pressed
6263 let ctrlc_pressed = Arc :: new ( Mutex :: new ( false ) ) ;
@@ -91,6 +92,20 @@ async fn async_watch(
9192 }
9293
9394 for event in events {
95+ // if there is a file named rewatch.lock in the events path, we can quit the watcher
96+ if let Some ( _) = event. paths . iter ( ) . find ( |path| path. ends_with ( "rewatch.lock" ) ) {
97+ match event. kind {
98+ EventKind :: Remove ( _) => {
99+ if show_progress {
100+ println ! ( "\n Exiting... (lockfile removed)" ) ;
101+ }
102+ clean:: cleanup_after_build ( & build_state) ;
103+ return Ok ( ( ) ) ;
104+ }
105+ _ => ( ) ,
106+ }
107+ }
108+
94109 let paths = event
95110 . paths
96111 . iter ( )
@@ -214,7 +229,7 @@ async fn async_watch(
214229 }
215230 CompileType :: Full => {
216231 let timing_total = Instant :: now ( ) ;
217- build_state = build:: initialize_build ( None , filter, show_progress, path, None )
232+ build_state = build:: initialize_build ( None , filter, show_progress, path, bsc_path . clone ( ) )
218233 . expect ( "Can't initialize build" ) ;
219234 let _ = build:: incremental_build (
220235 & mut build_state,
@@ -259,6 +274,7 @@ pub fn start(
259274 after_build : Option < String > ,
260275 create_sourcedirs : bool ,
261276 build_dev_deps : bool ,
277+ bsc_path : Option < String > ,
262278) {
263279 futures:: executor:: block_on ( async {
264280 let queue = Arc :: new ( FifoQueue :: < Result < Event , Error > > :: new ( ) ) ;
@@ -279,6 +295,7 @@ pub fn start(
279295 after_build,
280296 create_sourcedirs,
281297 build_dev_deps,
298+ bsc_path,
282299 )
283300 . await
284301 {
0 commit comments