Skip to content

Commit ab046fe

Browse files
committed
JBDS-4493 Virtualization detection never terminates on powershell<=2
1 parent aec9956 commit ab046fe

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

browser/services/platform.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Platform {
3939
static isVirtualizationEnabled() {
4040
return Platform.identify({
4141
win32: function() {
42-
return pify(child_process.exec)('powershell.exe -command "(GWMI Win32_Processor).VirtualizationFirmwareEnabled"').then((stdout)=>{
42+
return pify(child_process.exec)('powershell.exe -command "(GWMI Win32_Processor).VirtualizationFirmwareEnabled;[Environment]::Exit(0);"').then((stdout)=>{
4343
let result = Promise.resolve();
4444
if(stdout) {
4545
stdout = stdout.replace(/\s/g, '');
@@ -101,7 +101,7 @@ class Platform {
101101
static isHypervisorEnabled() {
102102
return Platform.identify({
103103
win32: function() {
104-
return pify(child_process.exec)('PowerShell.exe -ExecutionPolicy Bypass -command "Get-WindowsOptionalFeature -Online | where FeatureName -eq Microsoft-Hyper-V-Hypervisor | foreach{$_.state}"').then((stdout) => {
104+
return pify(child_process.exec)('PowerShell.exe -ExecutionPolicy Bypass -command "Get-WindowsOptionalFeature -Online | where FeatureName -eq Microsoft-Hyper-V-Hypervisor | foreach{$_.state}; [Environment]::Exit(0);"').then((stdout) => {
105105
let result = Promise.resolve();
106106
if(stdout) {
107107
stdout = stdout.replace(/\s/g, '');
@@ -137,7 +137,7 @@ class Platform {
137137
return Platform.identify({
138138
win32: ()=> {
139139
let disk = path.parse(location).root.charAt(0);
140-
return pify(child_process.exec)(`powershell -command "& {(Get-WMIObject Win32_Logicaldisk -filter \"deviceid=\`'${disk}:\`'\").FreeSpace }"`).then((stdout) => {
140+
return pify(child_process.exec)(`powershell -command "& {(Get-WMIObject Win32_Logicaldisk -filter \"deviceid=\`'${disk}:\`'\").FreeSpace; [Environment]::Exit(0);}"`).then((stdout) => {
141141
return Promise.resolve(Number.parseInt(stdout));
142142
}).catch(()=>{
143143
return Promise.resolve();
@@ -206,7 +206,7 @@ class Platform {
206206

207207
static getUserPath_win32() {
208208
return pify(child_process.exec)(
209-
'powershell.exe -executionpolicy bypass -command "[Environment]::GetEnvironmentVariable(\'path\', \'User\')"'
209+
'powershell.exe -executionpolicy bypass -command "[Environment]::GetEnvironmentVariable(\'path\', \'User\')[Environment]::Exit(0);"'
210210
).then(result=> Promise.resolve(result.replace(/\r?\n/g, '')));
211211
}
212212

uninstaller/create-uninstaller.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
$targetLocation = $args[0]
1+
$targetLocation = $args[0]
32
$timeStamp = $args[1]
43
$versionString = $args[2]
54

@@ -21,3 +20,4 @@ New-ItemProperty -Path $devsuiteItem -Name InstallDate -Value $installDate
2120
New-ItemProperty -Path $devsuiteItem -Name Publisher -Value "RedHat, Inc."
2221
New-ItemProperty -Path $devsuiteItem -Name UninstallString -Value $uninstallString
2322
New-ItemProperty -Path $devsuiteItem -Name DisplayIcon -Value $uninstallIcon
23+
[Environment]::Exit(0);

0 commit comments

Comments
 (0)