File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -492,17 +492,22 @@ export class SessionManager implements Middleware {
492492 let foundPowerShell : IPowerShellExeDetails | undefined ;
493493 try {
494494 let defaultPowerShell : IPowerShellExeDetails | undefined ;
495- if ( this . sessionSettings . powerShellDefaultVersion !== "" ) {
495+ const wantedName = this . sessionSettings . powerShellDefaultVersion ;
496+ if ( wantedName !== "" ) {
496497 for await ( const details of powershellExeFinder . enumeratePowerShellInstallations ( ) ) {
497498 // Need to compare names case-insensitively, from https://stackoverflow.com/a/2140723
498- const wantedName = this . sessionSettings . powerShellDefaultVersion ;
499499 if ( wantedName . localeCompare ( details . displayName , undefined , { sensitivity : "accent" } ) === 0 ) {
500500 defaultPowerShell = details ;
501501 break ;
502502 }
503503 }
504+
504505 }
505506 foundPowerShell = defaultPowerShell ?? await powershellExeFinder . getFirstAvailablePowerShellInstallation ( ) ;
507+ if ( defaultPowerShell === undefined && foundPowerShell !== undefined ) {
508+ void this . logger . writeAndShowWarning ( `The 'powerShellDefaultVersion' setting was '${ wantedName } ' but this was not found!`
509+ + ` Instead using first available installation '${ foundPowerShell . displayName } ' at '${ foundPowerShell . exePath } '!` ) ;
510+ }
506511 } catch ( e ) {
507512 this . logger . writeError ( `Error occurred while searching for a PowerShell executable:\n${ e } ` ) ;
508513 }
You can’t perform that action at this time.
0 commit comments