@@ -79,6 +79,8 @@ class JdkInstall extends InstallableItem {
7979 }
8080 done ( ) ;
8181 } ) . catch ( ( error ) => {
82+ Logger . info ( JdkInstall . KEY + ' - Detection failed with error' ) ;
83+ Logger . info ( JdkInstall . KEY + ' - ' + error ) ;
8284 if ( Platform . OS !== 'darwin' ) {
8385 this . selectedOption = 'install' ;
8486 } else {
@@ -88,23 +90,35 @@ class JdkInstall extends InstallableItem {
8890 } ) ;
8991 }
9092
91- findMsiInstalledJava ( ) {
92- let msiSearchScript = path . join ( this . installerDataSvc . tempDir ( ) , 'search-openjdk-msi.ps1' ) ;
93- let data = [
93+ getMsiSearchScriptLocation ( ) {
94+ return path . join ( this . installerDataSvc . tempDir ( ) , 'search-openjdk-msi.ps1' ) ;
95+ }
96+
97+ getMsiSearchScriptData ( ) {
98+ return [
9499 '$vbox = Get-WmiObject Win32_Product | where {$_.Name -like \'*OpenJDK*\'};' ,
95100 'echo $vbox.IdentifyingNumber;' ,
96101 '[Environment]::Exit(0);'
97102 ] . join ( '\r\n' ) ;
98- let args = [
103+ }
104+
105+ getMsiSearchScriptPowershellArgs ( msiSearchScript ) {
106+ return [
99107 '-NonInteractive' ,
100108 '-ExecutionPolicy' ,
101109 'ByPass' ,
102110 '-File' ,
103111 msiSearchScript
104112 ] ;
113+ }
114+
115+ findMsiInstalledJava ( ) {
116+ let msiSearchScript = this . getMsiSearchScriptLocation ( ) ;
117+ let data = this . getMsiSearchScriptData ( ) ;
118+ let args = this . getMsiSearchScriptPowershellArgs ( msiSearchScript ) ;
105119 let result = Promise . resolve ( '' ) ;
106120 if ( Platform . OS !== 'darwin' ) {
107- result = Util . writeFile ( JdkInstall . KEY , msiSearchScript , data ) . then ( ( ) => {
121+ result = Util . writeFile ( msiSearchScript , data ) . then ( ( ) => {
108122 return Util . executeFile ( 'powershell' , args ) ;
109123 } ) ;
110124 }
0 commit comments