@@ -6,8 +6,8 @@ var path = require('path')
6
6
7
7
/* This script is supposed to be running in project root directory
8
8
* 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
+ */
11
11
// for column one based error message
12
12
process . env . BS_VSCODE = 1
13
13
var bsb_exe = "bsb.exe"
@@ -20,7 +20,7 @@ var reasons_to_rebuild = [];
20
20
/**
21
21
* watchers are held so that we close it later
22
22
*/
23
- var watchers = [ ] ;
23
+ var watchers = [ ] ;
24
24
25
25
function get_building_status ( ) {
26
26
return is_building ;
@@ -33,7 +33,7 @@ function mark_is_building() {
33
33
}
34
34
var sourcedirs = path . join ( 'lib' , 'bs' , '.sourcedirs' )
35
35
function watch_build ( watch_files ) {
36
- // close and remove all unused watchers
36
+ // close and remove all unused watchers
37
37
watchers = watchers . filter ( function ( watcher ) {
38
38
if ( watcher . dir === bsconfig ) {
39
39
return true ;
@@ -59,7 +59,7 @@ function watch_build(watch_files) {
59
59
}
60
60
/*
61
61
watchers = watch_files.map(function (dir) {
62
- var watcher = fs.watch(dir)
62
+ var watcher = fs.watch(dir)
63
63
return {dir : dir , watcher : watcher}
64
64
})
65
65
watchers.forEach(function (watcher) {
@@ -69,11 +69,7 @@ function watch_build(watch_files) {
69
69
*/
70
70
} ;
71
71
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 ( ) {
77
73
console . log ( ">>>> Finish compiling" )
78
74
is_building = false ;
79
75
if ( reasons_to_rebuild . length != 0 ) {
@@ -91,7 +87,9 @@ function build() {
91
87
else {
92
88
console . log ( ">>>> Start compiling" ) ;
93
89
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 ) ;
95
93
}
96
94
}
97
95
function on_change ( event , reason ) {
@@ -105,12 +103,11 @@ function getWatchFiles(file) {
105
103
} else {
106
104
return [ ]
107
105
}
108
-
106
+
109
107
}
110
108
111
109
112
- // Initialization
110
+ // Initialization
113
111
114
112
watchers . push ( { watcher : fs . watch ( bsconfig , on_change ) , dir : bsconfig } ) ;
115
113
build ( ) ;
116
-
0 commit comments