@@ -18,18 +18,21 @@ var install = module.exports;
18
18
* run loop. (So don't combine the callback with `this.async()`)
19
19
*
20
20
* @param {String } installer Which package manager to use
21
- * @param {String|Array } [paths] Packages to install.Use an empty string for `npm install`
22
- * @param {Object } [options] Options to pass to `dargs` as arguments, then to `child_process.spawn`
21
+ * @param {String|Array } [paths] Packages to install. Use an empty string for `npm install`
22
+ * @param {Object } [options] Options to pass to `dargs` as arguments
23
23
* @param {Function } [cb]
24
+ * @param {Object } [spawnOptions] Options to pass `child_process.spawn`. ref
25
+ * https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options
24
26
*/
25
27
26
- install . runInstall = function ( installer , paths , options , cb ) {
28
+ install . runInstall = function ( installer , paths , options , cb , spawnOptions ) {
27
29
if ( ! cb && _ . isFunction ( options ) ) {
28
30
cb = options ;
29
31
options = { } ;
30
32
}
31
33
32
34
options = options || { } ;
35
+ spawnOptions = spawnOptions || { } ;
33
36
cb = cb || function ( ) { } ;
34
37
paths = Array . isArray ( paths ) ? paths : paths && paths . split ( ' ' ) || [ ] ;
35
38
@@ -53,7 +56,7 @@ install.runInstall = function (installer, paths, options, cb) {
53
56
54
57
this . env . runLoop . add ( 'install' , function ( done ) {
55
58
this . emit ( installer + 'Install' , paths ) ;
56
- this . spawnCommand ( installer , args , options )
59
+ this . spawnCommand ( installer , args , spawnOptions )
57
60
. on ( 'error' , function ( err ) {
58
61
console . log ( chalk . red ( 'Could not finish installation. \n' ) +
59
62
'Please install ' + installer + ' with ' +
@@ -150,12 +153,13 @@ install.installDependencies = function (options) {
150
153
* The installation will automatically run during the run loop `install` phase.
151
154
*
152
155
* @param {String|Array } [cmpnt] Components to install
153
- * @param {Object } [options] Options to pass to `child_process.spawn` when invoking bower.
156
+ * @param {Object } [options] Options to pass to `dargs` as arguments
154
157
* @param {Function } [cb]
158
+ * @param {Object } [spawnOptions] Options to pass `child_process.spawn`.
155
159
*/
156
160
157
- install . bowerInstall = function install ( cmpnt , options , cb ) {
158
- return this . runInstall ( 'bower' , cmpnt , options , cb ) ;
161
+ install . bowerInstall = function install ( cmpnt , options , cb , spawnOptions ) {
162
+ return this . runInstall ( 'bower' , cmpnt , options , cb , spawnOptions ) ;
159
163
} ;
160
164
161
165
/**
@@ -164,23 +168,25 @@ install.bowerInstall = function install(cmpnt, options, cb) {
164
168
* The installation will automatically run during the run loop `install` phase.
165
169
*
166
170
* @param {String|Array } [pkgs] Packages to install
167
- * @param {Object } [options] Options to pass to `child_process.spawn` when invoking npm.
171
+ * @param {Object } [options] Options to pass to `dargs` as arguments
168
172
* @param {Function } [cb]
173
+ * @param {Object } [spawnOptions] Options to pass `child_process.spawn`.
169
174
*/
170
175
171
- install . npmInstall = function install ( pkgs , options , cb ) {
172
- return this . runInstall ( 'npm' , pkgs , options , cb ) ;
176
+ install . npmInstall = function install ( pkgs , options , cb , spawnOptions ) {
177
+ return this . runInstall ( 'npm' , pkgs , options , cb , spawnOptions ) ;
173
178
} ;
174
179
/**
175
180
* Receives a list of `packages` and an `options` object to install through npm.
176
181
*
177
182
* The installation will automatically run during the run loop `install` phase.
178
183
*
179
184
* @param {String|Array } [pkgs] Packages to install
180
- * @param {Object } [options] Options to pass to `child_process.spawn` when invoking npm.
185
+ * @param {Object } [options] Options to pass to `dargs` as arguments
181
186
* @param {Function } [cb]
187
+ * @param {Object } [spawnOptions] Options to pass `child_process.spawn`.
182
188
*/
183
189
184
- install . yarnInstall = function install ( pkgs , options , cb ) {
185
- return this . runInstall ( 'yarn' , pkgs , options , cb ) ;
190
+ install . yarnInstall = function install ( pkgs , options , cb , spawnOptions ) {
191
+ return this . runInstall ( 'yarn' , pkgs , options , cb , spawnOptions ) ;
186
192
} ;
0 commit comments