@@ -54,9 +54,18 @@ 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 = build:: initialize_build ( None , filter, show_progress, path, None , build_dev_deps)
59- . expect ( "Can't initialize build" ) ;
59+ let mut build_state = build:: initialize_build (
60+ None ,
61+ filter,
62+ show_progress,
63+ path,
64+ None ,
65+ build_dev_deps,
66+ bsc_path. clone ( ) ,
67+ )
68+ . expect ( "Can't initialize build" ) ;
6069 let mut needs_compile_type = CompileType :: Incremental ;
6170 // create a mutex to capture if ctrl-c was pressed
6271 let ctrlc_pressed = Arc :: new ( Mutex :: new ( false ) ) ;
@@ -91,6 +100,20 @@ async fn async_watch(
91100 }
92101
93102 for event in events {
103+ // if there is a file named rewatch.lock in the events path, we can quit the watcher
104+ if let Some ( _) = event. paths . iter ( ) . find ( |path| path. ends_with ( "rewatch.lock" ) ) {
105+ match event. kind {
106+ EventKind :: Remove ( _) => {
107+ if show_progress {
108+ println ! ( "\n Exiting... (lockfile removed)" ) ;
109+ }
110+ clean:: cleanup_after_build ( & build_state) ;
111+ return Ok ( ( ) ) ;
112+ }
113+ _ => ( ) ,
114+ }
115+ }
116+
94117 let paths = event
95118 . paths
96119 . iter ( )
@@ -214,9 +237,8 @@ async fn async_watch(
214237 }
215238 CompileType :: Full => {
216239 let timing_total = Instant :: now ( ) ;
217- build_state =
218- build:: initialize_build ( None , filter, show_progress, path, None , build_dev_deps)
219- . expect ( "Can't initialize build" ) ;
240+ build_state = build:: initialize_build ( None , filter, show_progress, path, None )
241+ . expect ( "Can't initialize build" ) ;
220242 let _ = build:: incremental_build (
221243 & mut build_state,
222244 None ,
@@ -260,6 +282,7 @@ pub fn start(
260282 after_build : Option < String > ,
261283 create_sourcedirs : bool ,
262284 build_dev_deps : bool ,
285+ bsc_path : Option < String > ,
263286) {
264287 futures:: executor:: block_on ( async {
265288 let queue = Arc :: new ( FifoQueue :: < Result < Event , Error > > :: new ( ) ) ;
@@ -280,6 +303,7 @@ pub fn start(
280303 after_build,
281304 create_sourcedirs,
282305 build_dev_deps,
306+ bsc_path,
283307 )
284308 . await
285309 {
0 commit comments