Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

move env consolidation after loading envFile #935

Merged
merged 4 commits into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
out
node_modules
.vscode-test
*.vsix
*.vsix
.DS_Store
18 changes: 3 additions & 15 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class Delve {
this.program = program;
this.remotePath = remotePath;
let mode = launchArgs.mode;
let env = launchArgs.env || {};
let env = Object.assign({}, launchArgs.env, process.env);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this way the process.env overrides launchArgs.env
It should be the other way around

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check last commit, I changed it.

let dlvCwd = dirname(program);
let isProgramDirectory = false;
this.connection = new Promise((resolve, reject) => {
Expand Down Expand Up @@ -226,20 +226,8 @@ class Delve {
}
}

// Consolidate env vars
let finalEnv: Object = null;
if (Object.keys(env).length > 0) {
finalEnv = {};
for (let k in process.env) {
finalEnv[k] = process.env[k];
}
for (let k in env) {
finalEnv[k] = env[k];
}
}

if (!!launchArgs.noDebug && mode === 'debug' && !isProgramDirectory) {
this.debugProcess = spawn(getGoRuntimePath(), ['run', program], {env: finalEnv});
this.debugProcess = spawn(getGoRuntimePath(), ['run', program], { env });
this.debugProcess.stderr.on('data', chunk => {
let str = chunk.toString();
if (this.onstderr) { this.onstderr(str); }
Expand Down Expand Up @@ -301,7 +289,7 @@ class Delve {

this.debugProcess = spawn(dlv, dlvArgs, {
cwd: dlvCwd,
env: finalEnv,
env,
});

function connectClient(port: number, host: string) {
Expand Down