Skip to content

Commit 8d8ef63

Browse files
authored
IEP-1644 Release 3.7.0 regression testing: Terminal does not work (#1325)
* fix: avoiding duplicate PATH variable
1 parent baeb8a5 commit 8d8ef63

File tree

1 file changed

+4
-2
lines changed
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util

1 file changed

+4
-2
lines changed

bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,9 @@ public static Map<String, String> getSystemEnv()
900900
env.put(IDFCorePreferenceConstants.IDF_TOOLS_PATH, idfToolsPath);
901901

902902
// Merge Homebrew bin paths into PATH
903-
String existingPath = env.getOrDefault("PATH", ""); //$NON-NLS-1$ //$NON-NLS-2$
903+
// Windows may use "Path" while Unix uses "PATH"
904+
String keyPath = env.containsKey("PATH") ? "PATH" : "Path"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
905+
String existingPath = env.getOrDefault(keyPath, ""); //$NON-NLS-1$
904906
StringBuilder newPath = new StringBuilder();
905907

906908
String[] brewPaths = { "/usr/local/bin", "/opt/homebrew/bin" }; //$NON-NLS-1$ //$NON-NLS-2$
@@ -915,7 +917,7 @@ public static Map<String, String> getSystemEnv()
915917

916918
// Append the original PATH at the end
917919
newPath.append(existingPath);
918-
env.put("PATH", newPath.toString()); //$NON-NLS-1$
920+
env.put(keyPath, newPath.toString()); // $NON-NLS-1$
919921

920922
return env;
921923
}

0 commit comments

Comments
 (0)