Skip to content

Commit 01c4a2b

Browse files
actually use setting...
1 parent 47ccbba commit 01c4a2b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/session.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,19 @@ export class SessionManager implements Middleware {
121121
this.promptPowerShellExeSettingsCleanup();
122122

123123
try {
124-
this.PowerShellExeDetails = this.powershellExeFinder.getFirstAvailablePowerShellInstallation();
124+
let powerShellExeDetails;
125+
if (this.sessionSettings.powerShellDefaultVersion) {
126+
for (const details of this.powershellExeFinder.enumeratePowerShellInstallations()) {
127+
if (details.displayName === this.sessionSettings.powerShellDefaultVersion) {
128+
powerShellExeDetails = details;
129+
break;
130+
}
131+
}
132+
}
133+
134+
this.PowerShellExeDetails = powerShellExeDetails ||
135+
this.powershellExeFinder.getFirstAvailablePowerShellInstallation();
136+
125137
} catch (e) {
126138
this.log.writeError(`Error occurred while searching for a PowerShell executable:\n${e}`);
127139
}

0 commit comments

Comments
 (0)