@@ -39,7 +39,7 @@ export class ProjectBuildCache {
3939 * null === we haven't tried to initialize yet
4040 * undefined === unable to initialize
4141 */
42- private static _tarUtility : TarExecutable | null | undefined = null ;
42+ private static _tarUtilityPromise : Promise < TarExecutable | undefined > | null = null ;
4343
4444 private readonly _project : RushConfigurationProject ;
4545 private readonly _localBuildCacheProvider : FileSystemBuildCacheProvider ;
@@ -57,12 +57,12 @@ export class ProjectBuildCache {
5757 this . _cacheId = cacheId ;
5858 }
5959
60- private static _tryGetTarUtility ( terminal : ITerminal ) : TarExecutable | undefined {
61- if ( ProjectBuildCache . _tarUtility === null ) {
62- ProjectBuildCache . _tarUtility = TarExecutable . tryInitialize ( terminal ) ;
60+ private static _tryGetTarUtility ( terminal : ITerminal ) : Promise < TarExecutable | undefined > {
61+ if ( ProjectBuildCache . _tarUtilityPromise === null ) {
62+ ProjectBuildCache . _tarUtilityPromise = TarExecutable . tryInitializeAsync ( terminal ) ;
6363 }
6464
65- return ProjectBuildCache . _tarUtility ;
65+ return ProjectBuildCache . _tarUtilityPromise ;
6666 }
6767
6868 public static async tryGetProjectBuildCache (
@@ -180,7 +180,7 @@ export class ProjectBuildCache {
180180 )
181181 ) ;
182182
183- const tarUtility : TarExecutable | undefined = ProjectBuildCache . _tryGetTarUtility ( terminal ) ;
183+ const tarUtility : TarExecutable | undefined = await ProjectBuildCache . _tryGetTarUtility ( terminal ) ;
184184 let restoreSuccess : boolean = false ;
185185 if ( tarUtility && localCacheEntryPath ) {
186186 const logFilePath : string = this . _getTarLogFilePath ( ) ;
@@ -263,7 +263,7 @@ export class ProjectBuildCache {
263263
264264 let localCacheEntryPath : string | undefined ;
265265
266- const tarUtility : TarExecutable | undefined = ProjectBuildCache . _tryGetTarUtility ( terminal ) ;
266+ const tarUtility : TarExecutable | undefined = await ProjectBuildCache . _tryGetTarUtility ( terminal ) ;
267267 if ( tarUtility ) {
268268 const tempLocalCacheEntryPath : string = this . _localBuildCacheProvider . getCacheEntryPath ( cacheId ) ;
269269 const logFilePath : string = this . _getTarLogFilePath ( ) ;
0 commit comments