File tree 1 file changed +7
-2
lines changed
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 {
492
492
let foundPowerShell : IPowerShellExeDetails | undefined ;
493
493
try {
494
494
let defaultPowerShell : IPowerShellExeDetails | undefined ;
495
- if ( this . sessionSettings . powerShellDefaultVersion !== "" ) {
495
+ const wantedName = this . sessionSettings . powerShellDefaultVersion ;
496
+ if ( wantedName !== "" ) {
496
497
for await ( const details of powershellExeFinder . enumeratePowerShellInstallations ( ) ) {
497
498
// Need to compare names case-insensitively, from https://stackoverflow.com/a/2140723
498
- const wantedName = this . sessionSettings . powerShellDefaultVersion ;
499
499
if ( wantedName . localeCompare ( details . displayName , undefined , { sensitivity : "accent" } ) === 0 ) {
500
500
defaultPowerShell = details ;
501
501
break ;
502
502
}
503
503
}
504
+
504
505
}
505
506
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
+ }
506
511
} catch ( e ) {
507
512
this . logger . writeError ( `Error occurred while searching for a PowerShell executable:\n${ e } ` ) ;
508
513
}
You can’t perform that action at this time.
0 commit comments