Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-02-25 14:04:10 +0000
committerUwe Stieber2014-02-25 14:04:10 +0000
commite716a93a539a81af3a10a72df0280986efac9414 (patch)
tree862370e9338cbd5ad69cf899a300d6d5f6e0971c
parent52b89e22a908d2e053681d15433bfe16066fa2da (diff)
downloadorg.eclipse.tcf-e716a93a539a81af3a10a72df0280986efac9414.tar.gz
org.eclipse.tcf-e716a93a539a81af3a10a72df0280986efac9414.tar.xz
org.eclipse.tcf-e716a93a539a81af3a10a72df0280986efac9414.zip
Target Explorer: Support unsetting an environment variable in the merged process environment
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java
index 8ad763500..54d344fa8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java
@@ -96,13 +96,18 @@ public class Env {
// Don't overwrite the TERM variable if in terminal mode
if (terminal && "TERM".equals(name)) continue; //$NON-NLS-1$
// If a variable with the name does not exist, just append it
- if (!env.containsKey(name)) {
+ if (!env.containsKey(name) && !"<unset>".equals(value)) { //$NON-NLS-1$
env.put(name, value);
- } else {
- // A variable with the name already exist, check if the value is different
- String oldValue = env.get(name);
- if (oldValue != null && !oldValue.equals(value) || oldValue == null && value != null) {
- env.put(name, value);
+ } else if (env.containsKey(name)) {
+ // If the value contains the special placeholder "<unset>", remove the variable from the environment
+ if ("<unset>".equals(value)) {//$NON-NLS-1$
+ env.remove(name);
+ } else {
+ // A variable with the name already exist, check if the value is different
+ String oldValue = env.get(name);
+ if (oldValue != null && !oldValue.equals(value) || oldValue == null && value != null) {
+ env.put(name, value);
+ }
}
}
}

Back to the top