Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: envFiles variables appending rather than replacing in attach #1832

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he

## Nightly (only)

- fix: envFiles variables appending rather than replacing in attach ([vscode#1935510](https://github.com/microsoft/vscode/issues/1935510))
- fix: make source map renames scope-aware
- fix: error when processing private properties with a map ([#1824](https://github.com/microsoft/vscode-js-debug/issues/1824))

Expand Down
7 changes: 6 additions & 1 deletion src/targets/node/nodeAttacherBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { delay } from '../../common/promiseUtil';
import { AnyNodeConfiguration } from '../../configuration';
import { NodeLauncherBase } from './nodeLauncherBase';

/** Variables that should be appended rather than replaced in the environment */
const appendVars: readonly string[] = ['NODE_OPTIONS', 'VSCODE_INSPECTOR_OPTIONS'];

/**
* Base class that implements common matters for attachment.
*/
Expand All @@ -22,7 +25,9 @@ export abstract class NodeAttacherBase<T extends AnyNodeConfiguration> extends N
Object.entries(vars.defined())
.map(([key, value]) => {
const k = JSON.stringify(key);
return `process.env[${k}]=(process.env[${k}]||'')+${JSON.stringify(value)}`;
return appendVars.includes(key)
? `process.env[${k}]=(process.env[${k}]||'')+${JSON.stringify(value)}`
: `process.env[${k}]=${JSON.stringify(value)}`;
})
.join(';') +
'})()' +
Expand Down
Loading