File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed
packages/@angular/cli/tasks Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change 11const Task = require ( '../ember-cli/lib/models/task' ) ;
22import chalk from 'chalk' ;
3- import { exec } from 'child_process' ;
3+ import { spawn } from 'child_process' ;
44
55
66export default Task . extend ( {
@@ -12,24 +12,28 @@ export default Task.extend({
1212 }
1313
1414 ui . writeLine ( chalk . green ( `Installing packages for tooling via ${ packageManager } .` ) ) ;
15- let installCommand = `${ packageManager } install` ;
15+
16+ const installArgs = [ 'install' ] ;
1617 if ( packageManager === 'npm' ) {
17- installCommand = ` ${ packageManager } --quiet install` ;
18+ installArgs . push ( ' --quiet' ) ;
1819 }
20+ const installOptions = {
21+ stdio : 'inherit' ,
22+ shell : true
23+ } ;
1924
2025 return new Promise ( ( resolve , reject ) => {
21- exec ( installCommand ,
22- ( err : NodeJS . ErrnoException , _stdout : string , stderr : string ) => {
23- if ( err ) {
24- ui . writeLine ( stderr ) ;
26+ spawn ( packageManager , installArgs , installOptions )
27+ . on ( 'close' , ( code : number ) => {
28+ if ( code === 0 ) {
29+ ui . writeLine ( chalk . green ( `Installed packages for tooling via ${ packageManager } .` ) ) ;
30+ resolve ( ) ;
31+ } else {
2532 const message = 'Package install failed, see above.' ;
2633 ui . writeLine ( chalk . red ( message ) ) ;
2734 reject ( message ) ;
28- } else {
29- ui . writeLine ( chalk . green ( `Installed packages for tooling via ${ packageManager } .` ) ) ;
30- resolve ( ) ;
3135 }
32- } ) ;
36+ } ) ;
3337 } ) ;
3438 }
3539} ) ;
You can’t perform that action at this time.
0 commit comments