File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
packages/core/src/shared/sam/cli Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,17 @@ import { mergeResolvedShellPath } from '../../env/resolveEnv'
1616interface SamLocation {
1717 path : string
1818 version : string
19- verified ?: boolean
2019}
2120export class SamCliLocationProvider {
2221 private static samCliLocator : BaseSamCliLocator | undefined
2322 protected static cachedSamLocation : SamLocation | undefined
23+ private static samLocationValid : boolean = false
2424
2525 /** Checks that the given `sam` actually works by invoking `sam --version`. */
2626 private static async isValidSamLocation ( samPath : string ) {
27- return await tryRun ( samPath , [ '--version' ] , 'no' , 'SAM CLI' )
27+ const isValid = await tryRun ( samPath , [ '--version' ] , 'no' , 'SAM CLI' )
28+ this . samLocationValid = isValid
29+ return isValid
2830 }
2931
3032 /**
@@ -36,8 +38,11 @@ export class SamCliLocationProvider {
3638 const cachedLoc = forceSearch ? undefined : SamCliLocationProvider . cachedSamLocation
3739
3840 // Avoid searching the system for `sam` (especially slow on Windows).
39- if ( cachedLoc && ( cachedLoc . verified || ( await SamCliLocationProvider . isValidSamLocation ( cachedLoc . path ) ) ) ) {
40- cachedLoc . verified = true
41+ if (
42+ cachedLoc &&
43+ ( SamCliLocationProvider . samLocationValid ||
44+ ( await SamCliLocationProvider . isValidSamLocation ( cachedLoc . path ) ) )
45+ ) {
4146 perflog . done ( )
4247 return cachedLoc
4348 }
You can’t perform that action at this time.
0 commit comments