File tree 1 file changed +15
-11
lines changed
packages/@angular/cli/tasks
1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change 1
1
const Task = require ( '../ember-cli/lib/models/task' ) ;
2
2
import chalk from 'chalk' ;
3
- import { exec } from 'child_process' ;
3
+ import { spawn } from 'child_process' ;
4
4
5
5
6
6
export default Task . extend ( {
@@ -12,24 +12,28 @@ export default Task.extend({
12
12
}
13
13
14
14
ui . writeLine ( chalk . green ( `Installing packages for tooling via ${ packageManager } .` ) ) ;
15
- let installCommand = `${ packageManager } install` ;
15
+
16
+ const installArgs = [ 'install' ] ;
16
17
if ( packageManager === 'npm' ) {
17
- installCommand = ` ${ packageManager } --quiet install` ;
18
+ installArgs . push ( ' --quiet' ) ;
18
19
}
20
+ const installOptions = {
21
+ stdio : 'inherit' ,
22
+ shell : true
23
+ } ;
19
24
20
25
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 {
25
32
const message = 'Package install failed, see above.' ;
26
33
ui . writeLine ( chalk . red ( message ) ) ;
27
34
reject ( message ) ;
28
- } else {
29
- ui . writeLine ( chalk . green ( `Installed packages for tooling via ${ packageManager } .` ) ) ;
30
- resolve ( ) ;
31
35
}
32
- } ) ;
36
+ } ) ;
33
37
} ) ;
34
38
}
35
39
} ) ;
You can’t perform that action at this time.
0 commit comments