@@ -6,8 +6,8 @@ var path = require('path')
66
77/* This script is supposed to be running in project root directory
88 * It matters since we need read .sourcedirs(location)
9- * and its content are file/directories with regard to project root
10- */
9+ * and its content are file/directories with regard to project root
10+ */
1111// for column one based error message
1212process . env . BS_VSCODE = 1
1313var bsb_exe = "bsb.exe"
@@ -20,7 +20,7 @@ var reasons_to_rebuild = [];
2020/**
2121 * watchers are held so that we close it later
2222 */
23- var watchers = [ ] ;
23+ var watchers = [ ] ;
2424
2525function get_building_status ( ) {
2626 return is_building ;
@@ -33,7 +33,7 @@ function mark_is_building() {
3333}
3434var sourcedirs = path . join ( 'lib' , 'bs' , '.sourcedirs' )
3535function watch_build ( watch_files ) {
36- // close and remove all unused watchers
36+ // close and remove all unused watchers
3737 watchers = watchers . filter ( function ( watcher ) {
3838 if ( watcher . dir === bsconfig ) {
3939 return true ;
@@ -59,7 +59,7 @@ function watch_build(watch_files) {
5959 }
6060 /*
6161 watchers = watch_files.map(function (dir) {
62- var watcher = fs.watch(dir)
62+ var watcher = fs.watch(dir)
6363 return {dir : dir , watcher : watcher}
6464 })
6565 watchers.forEach(function (watcher) {
@@ -69,11 +69,7 @@ function watch_build(watch_files) {
6969 */
7070} ;
7171
72- function build_finised_callback ( err , stdout , stderr ) {
73- // The stderr output is captured by ninja
74- // and converted to stdout, so we have to dump everything
75- console . log ( stdout ) ;
76- console . log ( stderr ) ;
72+ function build_finished_callback ( ) {
7773 console . log ( ">>>> Finish compiling" )
7874 is_building = false ;
7975 if ( reasons_to_rebuild . length != 0 ) {
@@ -91,7 +87,9 @@ function build() {
9187 else {
9288 console . log ( ">>>> Start compiling" ) ;
9389 mark_is_building ( )
94- child_process . execFile ( bsb , build_finised_callback )
90+ child_process
91+ . spawn ( bsb , { stdio : 'inherit' } )
92+ . on ( 'exit' , build_finished_callback ) ;
9593 }
9694}
9795function on_change ( event , reason ) {
@@ -105,12 +103,11 @@ function getWatchFiles(file) {
105103 } else {
106104 return [ ]
107105 }
108-
106+
109107}
110108
111109
112- // Initialization
110+ // Initialization
113111
114112watchers . push ( { watcher : fs . watch ( bsconfig , on_change ) , dir : bsconfig } ) ;
115113build ( ) ;
116-
0 commit comments