Skip to content

Commit

Permalink
Resolve windows opensearch-env.bat having variable delayed expansion …
Browse files Browse the repository at this point in the history
…issues on OPENSEARCH_HOME assignment introduced in #6956 (#7080)

* Resolve windows opensearch-env.bat having variable delayed expansion issues on OPENSEARCH_HOME assignment

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

* Remove changelog entry

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

---------

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
peterzhuamazon authored Apr 11, 2023
1 parent 4991a0a commit 810b985
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions distribution/src/bin/opensearch-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ set SCRIPT=%0
rem determine OpenSearch home; to do this, we strip from the path until we
rem find bin, and then strip bin (there is an assumption here that there is no
rem nested directory under bin also named bin)
if not defined OPENSEARCH_HOME (
for %%I in (%SCRIPT%) do set OPENSEARCH_HOME=%%~dpI

:opensearch_home_loop
for %%I in ("%OPENSEARCH_HOME:~1,-1%") do set DIRNAME=%%~nxI
if not "%DIRNAME%" == "bin" (
for %%I in ("%OPENSEARCH_HOME%..") do set OPENSEARCH_HOME=%%~dpfI
goto opensearch_home_loop
)
if not defined OPENSEARCH_HOME goto opensearch_home_start_setup
goto opensearch_home_done_setup

:opensearch_home_start_setup
for %%I in (%SCRIPT%) do set OPENSEARCH_HOME=%%~dpI

:opensearch_home_loop
for %%I in ("%OPENSEARCH_HOME:~1,-1%") do set DIRNAME=%%~nxI
if not "%DIRNAME%" == "bin" (
for %%I in ("%OPENSEARCH_HOME%..") do set OPENSEARCH_HOME=%%~dpfI
goto opensearch_home_loop
)
for %%I in ("%OPENSEARCH_HOME%..") do set OPENSEARCH_HOME=%%~dpfI

:opensearch_home_done_setup
rem now set the classpath
set OPENSEARCH_CLASSPATH=!OPENSEARCH_HOME!\lib\*

Expand Down

0 comments on commit 810b985

Please sign in to comment.