@@ -114,9 +114,9 @@ export class Installer extends EventEmitter {
114
114
// no current version
115
115
}
116
116
117
- if ( this . installing ) {
118
- this . setState ( this . installing , InstallState . installing ) ;
119
- }
117
+ this . installing . forEach ( ( version ) => {
118
+ this . setState ( version , InstallState . installing ) ;
119
+ } ) ;
120
120
121
121
// already downloaded...
122
122
const str = `^electron-v(.*)-${ process . platform } -${ process . arch } .zip$` ;
@@ -274,19 +274,23 @@ export class Installer extends EventEmitter {
274
274
return promise ;
275
275
}
276
276
277
- /** the currently-installing version, if any */
278
- private installing : string | undefined ;
277
+ /** keep a track of all currently installing versions */
278
+ private installing = new Set < string > ( ) ;
279
279
280
280
public async install (
281
281
version : string ,
282
282
opts ?: Partial < InstallerParams > ,
283
283
) : Promise < string > {
284
284
const d = debug ( `fiddle-core:Installer:${ version } :install` ) ;
285
285
const { electronInstall } = this . paths ;
286
+ const isVersionInstalling = this . installing . has ( version ) ;
286
287
const electronExec = Installer . getExecPath ( electronInstall ) ;
287
288
288
- if ( this . installing ) throw new Error ( `Currently installing "${ version } "` ) ;
289
- this . installing = version ;
289
+ if ( isVersionInstalling ) {
290
+ throw new Error ( `Currently installing "${ version } "` ) ;
291
+ }
292
+
293
+ this . installing . add ( version ) ;
290
294
291
295
// see if the current version (if any) is already `version`
292
296
const { installedVersion } = this ;
@@ -313,7 +317,7 @@ export class Installer extends EventEmitter {
313
317
this . setState ( version , InstallState . installed ) ;
314
318
}
315
319
316
- delete this . installing ;
320
+ this . installing . delete ( version ) ;
317
321
318
322
// return the full path to the electron executable
319
323
d ( inspect ( { electronExec, version } ) ) ;
0 commit comments