File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,18 @@ export function getDefaultPowerShellPath(
66
66
use32Bit : boolean = false ) : string | null {
67
67
68
68
let powerShellExePath ;
69
+ let psCoreInstallPath ;
69
70
70
71
// Find the path to powershell.exe based on the current platform
71
72
// and the user's desire to run the x86 version of PowerShell
72
73
if ( platformDetails . operatingSystem === OperatingSystem . Windows ) {
73
- const psCoreInstallPath =
74
- ( platformDetails . isProcess64Bit ? process . env . ProgramFiles : process . env . ProgramW6432 ) + "\\PowerShell" ;
74
+ if ( use32Bit ) {
75
+ psCoreInstallPath =
76
+ ( platformDetails . isProcess64Bit ? process . env . ProgramW6432 : process . env . ProgramFiles ) + "\\PowerShell" ;
77
+ } else {
78
+
79
+ psCoreInstallPath = psCoreInstallPath = process . env . ProgramFiles + "\\PowerShell" ;
80
+ }
75
81
if ( fs . existsSync ( psCoreInstallPath ) ) {
76
82
const arch = platformDetails . isProcess64Bit ? "(x64)" : "(x86)" ;
77
83
const psCorePaths =
@@ -87,22 +93,20 @@ export function getDefaultPowerShellPath(
87
93
} ) ) ;
88
94
89
95
if ( psCorePaths ) {
90
- powerShellExePath = psCorePaths [ 0 ] . exePath ;
96
+ return powerShellExePath = psCorePaths [ 0 ] . exePath ;
91
97
}
92
-
93
- } else {
94
- if ( use32Bit ) {
98
+ }
99
+ if ( use32Bit ) {
95
100
powerShellExePath =
96
101
platformDetails . isOS64Bit && platformDetails . isProcess64Bit
97
102
? SysWow64PowerShellPath
98
103
: System32PowerShellPath ;
99
- } else {
104
+ } else {
100
105
powerShellExePath =
101
106
! platformDetails . isOS64Bit || platformDetails . isProcess64Bit
102
107
? System32PowerShellPath
103
108
: SysnativePowerShellPath ;
104
109
}
105
- }
106
110
} else if ( platformDetails . operatingSystem === OperatingSystem . MacOS ) {
107
111
// Always default to the stable version of PowerShell (if installed) but handle case of only Preview installed
108
112
powerShellExePath = macOSExePath ;
You can’t perform that action at this time.
0 commit comments