@@ -32,12 +32,15 @@ const versionMap = {
3232 '8.0' : '8.0.1'
3333} ;
3434
35+ const env = Object . assign ( { } , process . env ) ;
36+ delete env . JAVA_HOME ;
37+
3538function run ( ) {
3639 const args = Array . from ( arguments ) ;
3740 console . log ( args . join ( ' ' ) ) ;
3841 const command = args . shift ( ) ;
3942 // spawn is safer and more lightweight than exec
40- const ret = spawnSync ( command , args , { stdio : 'inherit' } ) ;
43+ const ret = spawnSync ( command , args , { stdio : 'inherit' , env : env } ) ;
4144 if ( ret . status !== 0 ) {
4245 throw ret . error ;
4346 }
@@ -52,7 +55,7 @@ function runBat() {
5255 if ( ! fs . existsSync ( command ) ) {
5356 throw 'Bat not found' ;
5457 }
55- const ret = spawnSync ( command , args , { stdio : 'inherit' , shell : true } ) ;
58+ const ret = spawnSync ( command , args , { stdio : 'inherit' , env : env , shell : true } ) ;
5659 if ( ret . status !== 0 ) {
5760 throw ret . error ;
5861 }
@@ -198,15 +201,6 @@ const elasticsearchVersion = getVersion();
198201const cacheDir = path . join ( os . homedir ( ) , 'elasticsearch' ) ;
199202const esHome = path . join ( cacheDir , elasticsearchVersion ) ;
200203
201- // java compatibility
202- // https://www.elastic.co/support/matrix
203- const majorVersion = parseInt ( elasticsearchVersion . split ( '.' ) [ 0 ] ) ;
204- const javaHome = majorVersion == 8 ? process . env . JAVA_HOME_17_X64 : process . env . JAVA_HOME_21_X64 ;
205- if ( javaHome ) {
206- process . env . ES_JAVA_HOME = javaHome ;
207- addToEnv ( `ES_JAVA_HOME=${ javaHome } ` ) ;
208- }
209-
210204if ( ! fs . existsSync ( esHome ) ) {
211205 const tmpDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'elasticsearch-' ) ) ;
212206 process . chdir ( tmpDir ) ;
0 commit comments