@@ -126,27 +126,49 @@ function _buildApplication(args, desktopExternalModules, desktopJSBundlePath, de
126
126
console . log ( chalk . bold ( 'Building the app...' ) ) ;
127
127
128
128
var buildCommand = process . platform === "win32" ? "build.bat" : "./build.sh" ;
129
+ var buildArguments = [ ] ;
130
+
129
131
if ( typeof desktopExternalModules !== 'undefined' && desktopExternalModules !== null ) {
130
- buildCommand += ' -e "' + desktopExternalModules . toString ( ) . replace ( / , / g, ';' ) + '"' ;
132
+ buildArguments . push ( "-e" ) ;
133
+ buildArguments . push ( desktopExternalModules . toString ( ) . replace ( / , / g, ';' ) ) ;
131
134
}
132
135
if ( typeof desktopJSBundlePath !== 'undefined' && desktopJSBundlePath !== null ) {
133
- buildCommand += ' -j "' + desktopJSBundlePath . toString ( ) + '"' ;
136
+ buildArguments . push ( "-j" ) ;
137
+ buildArguments . push ( desktopJSBundlePath . toString ( ) ) ;
134
138
}
135
139
if ( typeof desktopFonts !== 'undefined' && desktopFonts !== null ) {
136
- buildCommand += ' -f "' + desktopFonts . toString ( ) . replace ( / , / g, ';' ) + '"' ;
140
+ buildArguments . push ( "-f" ) ;
141
+ buildArguments . push ( desktopFonts . toString ( ) . replace ( / , / g, ';' ) ) ;
137
142
}
138
143
if ( process . platform === "win32" ) {
139
- buildCommand += ' -g "' + "MinGW Makefiles" + '"' ;
144
+ buildArguments . push ( "-g" ) ;
145
+ buildArguments . push ( "MinGW Makefiles" ) ;
140
146
}
141
- child_process . exec ( buildCommand , { cwd : path . join ( args . root , 'desktop' ) } ,
142
- ( error , stdout , stderr ) => {
143
- if ( error )
144
- reject ( error ) ;
145
- else {
146
- console . log ( stdout ) ;
147
- resolve ( ) ;
148
- }
149
- } ) ;
147
+ var child = child_process . spawn ( buildCommand , buildArguments , { cwd : path . join ( args . root , 'desktop' ) } ) ;
148
+
149
+ var stdoutOutput ;
150
+ var stderrOutput ;
151
+ child . stdout . on ( 'data' , function ( data ) {
152
+ console . log ( 'stdout: ' + data ) ;
153
+ stdoutOutput += data ;
154
+ } ) ;
155
+
156
+ child . stderr . on ( 'data' , function ( data ) {
157
+ console . log ( 'stderr: ' + data ) ;
158
+ stderrOutput += data ;
159
+ } ) ;
160
+
161
+ child . on ( 'close' , function ( code ) {
162
+ console . log ( 'child process exited with code ' + code ) ;
163
+ if ( code != 0 ) {
164
+ reject ( )
165
+ }
166
+ else {
167
+ resolve ( ) ;
168
+ }
169
+ } ) ;
170
+
171
+
150
172
} ) ;
151
173
}
152
174
0 commit comments