Skip to content

Commit 6e1ac30

Browse files
committed
#59 setting environment variables in Launch
1 parent a12a6c2 commit 6e1ac30

File tree

4 files changed

+716
-1
lines changed

4 files changed

+716
-1
lines changed

org.nodeclipse.debug/src/org/nodeclipse/debug/launch/LaunchConfigurationDelegate.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import java.io.File;
44
import java.util.ArrayList;
5+
import java.util.HashMap;
56
import java.util.List;
7+
import java.util.Map;
68

79
import org.chromium.debug.core.ChromiumDebugPlugin;
810
import org.eclipse.core.resources.ResourcesPlugin;
@@ -114,10 +116,19 @@ public void launch(ILaunchConfiguration configuration, String mode,
114116
}
115117
}
116118

119+
Map<String, String> envm = new HashMap<String, String>();
120+
envm = configuration.getAttribute(Constants.ATTR_ENVIRONMENT_VARIABLES, envm);
121+
String[] envp = new String[envm.size()];
122+
int idx = 0;
123+
for(String key : envm.keySet()) {
124+
String value = envm.get(key);
125+
envp[idx++] = key + "=" + value;
126+
}
127+
117128
String[] cmds = {};
118129
cmds = cmdLine.toArray(cmds);
119130
// Launch a process to debug.eg,
120-
Process p = DebugPlugin.exec(cmds, workingPath);
131+
Process p = DebugPlugin.exec(cmds, workingPath, envp);
121132
RuntimeProcess process = (RuntimeProcess)DebugPlugin.newProcess(launch, p, Constants.PROCESS_MESSAGE);
122133
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
123134
if(!process.isTerminated()) {

org.nodeclipse.debug/src/org/nodeclipse/debug/launch/LaunchConfigurationTabGroup.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
1717
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
1818
new LaunchConfigurationMainTab(),
1919
new NodeArgumentsTab(),
20+
new NodeEnvironmentTab(),
2021
new CommonTab()
2122
};
2223
setTabs(tabs);

0 commit comments

Comments
 (0)