@@ -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
0 commit comments