mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
ProcessFactory.java : envpToEnvMap() consider null envp (#195)
This commit is contained in:
parent
ac64d4aedc
commit
352630b8ea
1 changed files with 11 additions and 8 deletions
|
@ -62,9 +62,17 @@ public class ProcessFactory {
|
|||
return environment;
|
||||
}
|
||||
|
||||
private static TreeMap<String, String> envpToEnvMap(String[] envp) {
|
||||
private static TreeMap<String, String> getDefaultEnvironment() {
|
||||
TreeMap<String, String> environment = newEmptyEnvironment();
|
||||
Map<String, String> env = new ProcessBuilder().environment();
|
||||
environment.putAll(env);
|
||||
return environment;
|
||||
}
|
||||
|
||||
private static TreeMap<String, String> envpToEnvMap(String[] envp) {
|
||||
TreeMap<String, String> environment;
|
||||
if (envp != null) {
|
||||
environment = newEmptyEnvironment();
|
||||
for (String envstring : envp) {
|
||||
int eqlsign = envstring.indexOf('=');
|
||||
if (eqlsign != -1) {
|
||||
|
@ -73,17 +81,12 @@ public class ProcessFactory {
|
|||
// Silently ignore envstrings lacking the required `='.
|
||||
}
|
||||
}
|
||||
} else {
|
||||
environment = getDefaultEnvironment();
|
||||
}
|
||||
return environment;
|
||||
}
|
||||
|
||||
private static TreeMap<String, String> getDefaultEnvironment() {
|
||||
TreeMap<String, String> environment = newEmptyEnvironment();
|
||||
Map<String, String> env = new ProcessBuilder().environment();
|
||||
environment.putAll(env);
|
||||
return environment;
|
||||
}
|
||||
|
||||
private static void appendEnvMapComparison(StringBuilder sb, TreeMap<String, String> environmentA,
|
||||
TreeMap<String, String> environmentB) {
|
||||
TreeMap<String, String> environmentC = newEmptyEnvironment();
|
||||
|
|
Loading…
Add table
Reference in a new issue