Skip to content

Commit

Permalink
Pass PATH environment variable when running cli tools
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Koval <kovalidis@gmail.com>
  • Loading branch information
anti-social committed May 15, 2024
1 parent a03db0d commit 0eb90c9
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,13 @@ private Map<String, String> getOpenSearchEnvironment() {
defaultEnv.put("HOSTNAME", HOSTNAME_OVERRIDE);
defaultEnv.put("COMPUTERNAME", COMPUTERNAME_OVERRIDE);

// Pass PATH environment variable to be able to run OpenSearch cli tools
var systemEnv = System.getenv();
var systemPath = systemEnv.get("PATH");
if (systemPath != null) {
defaultEnv.put("PATH", systemPath);
}

Set<String> commonKeys = new HashSet<>(environment.keySet());
commonKeys.retainAll(defaultEnv.keySet());
if (commonKeys.isEmpty() == false) {
Expand Down

0 comments on commit 0eb90c9

Please sign in to comment.