@@ -91,13 +91,26 @@ function createExecTask(packageName, executable, args) {
91
91
}
92
92
return function ( done ) {
93
93
resolveBin ( packageName , { executable : executable } , function ( err , binPath ) {
94
- child_process . exec ( `${ binPath } ${ args . join ( ' ' ) } ` , function ( error ) {
95
- if ( error ) {
96
- console . error ( error ) ;
97
- throw error ;
98
- } else {
99
- done ( ) ;
94
+ if ( err ) {
95
+ console . error ( err ) ;
96
+ throw err ;
97
+ }
98
+
99
+ const process = child_process . spawn ( binPath , args ) ;
100
+
101
+ process . stdout . on ( 'data' , ( data ) => {
102
+ console . log ( `stdout: ${ data } ` ) ;
103
+ } ) ;
104
+
105
+ process . stderr . on ( 'data' , ( data ) => {
106
+ console . log ( `stderr: ${ data } ` ) ;
107
+ } ) ;
108
+
109
+ process . on ( 'close' , ( code ) => {
110
+ if ( code != 0 ) {
111
+ throw new Error ( 'Process failed with code ' + code ) ;
100
112
}
113
+ done ( ) ;
101
114
} ) ;
102
115
} ) ;
103
116
}
@@ -141,7 +154,7 @@ gulp.task(':build:components:ngc', ['build:components'], createExecTask(
141
154
*/
142
155
gulp . task ( ':build:vendor' , function ( ) {
143
156
const npmVendorFiles = [
144
- 'core-js/client' , 'zone.js/dist ' , 'hammerjs ' , 'systemjs/dist' , 'rxjs' , '@angular' , 'hammerjs '
157
+ '@angular' , ' core-js/client', 'hammerjs ' , 'rxjs ' , 'systemjs/dist' , 'zone.js/dist '
145
158
] ;
146
159
147
160
return gulpMerge (
@@ -290,8 +303,9 @@ gulp.task('serve:e2eapp', ['build:e2eapp'], function(done) {
290
303
291
304
stopE2eServer = function ( ) {
292
305
stream . emit ( 'kill' ) ;
293
- done ( ) ;
294
306
} ;
307
+
308
+ return stream ;
295
309
} ) ;
296
310
297
311
gulp . task ( ':serve:e2eapp:stop' , function ( ) {
@@ -323,22 +337,16 @@ gulp.task(':test:protractor', createExecTask(
323
337
'protractor' , [ path . join ( __dirname , 'test/protractor.conf.js' ) ]
324
338
) ) ;
325
339
326
- gulp . task ( ':test:protractor:and-stop' , function ( done ) {
327
- gulpRunSequence (
328
- ':test:protractor' ,
329
- ':serve:e2eapp:stop' ,
330
- done
331
- ) ;
332
- } ) ;
333
-
334
340
gulp . task ( ':e2e:done' , function ( ) {
335
341
process . exit ( 0 ) ;
336
342
} ) ;
337
343
338
344
gulp . task ( 'e2e' , function ( done ) {
339
345
gulpRunSequence (
340
346
':test:protractor:setup' ,
341
- [ 'serve:e2eapp' , ':test:protractor:and-stop' ] ,
347
+ 'serve:e2eapp' ,
348
+ ':test:protractor' ,
349
+ ':serve:e2eapp:stop' ,
342
350
':e2e:done' ,
343
351
done
344
352
) ;
@@ -363,7 +371,9 @@ gulp.task('build:release', function(done) {
363
371
* Continuous Integration.
364
372
*/
365
373
gulp . task ( 'ci:lint' , [ 'lint' , 'stylelint' ] ) ;
366
- gulp . task ( 'ci:test' , [ 'test:single-run' ] ) ;
374
+ gulp . task ( 'ci:test' , [ 'test:single-run' ] , function ( ) {
375
+ process . exit ( 0 ) ;
376
+ } ) ;
367
377
gulp . task ( 'ci:e2e' , [ 'e2e' ] ) ;
368
378
gulp . task ( 'ci:extract-metadata' , [ ':build:components:ngc' ] ) ;
369
379
gulp . task ( 'ci:forbidden-identifiers' , function ( ) {
0 commit comments