Skip to content

Commit f38cea5

Browse files
authored
fix: envFiles variables appending rather than replacing in attach (#1832)
Fixes https://github.com/microsoft/vscode/issues/1935510
1 parent 03af2c8 commit f38cea5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he
44

55
## Nightly (only)
66

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

src/targets/node/nodeAttacherBase.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import { delay } from '../../common/promiseUtil';
1111
import { AnyNodeConfiguration } from '../../configuration';
1212
import { NodeLauncherBase } from './nodeLauncherBase';
1313

14+
/** Variables that should be appended rather than replaced in the environment */
15+
const appendVars: readonly string[] = ['NODE_OPTIONS', 'VSCODE_INSPECTOR_OPTIONS'];
16+
1417
/**
1518
* Base class that implements common matters for attachment.
1619
*/
@@ -22,7 +25,9 @@ export abstract class NodeAttacherBase<T extends AnyNodeConfiguration> extends N
2225
Object.entries(vars.defined())
2326
.map(([key, value]) => {
2427
const k = JSON.stringify(key);
25-
return `process.env[${k}]=(process.env[${k}]||'')+${JSON.stringify(value)}`;
28+
return appendVars.includes(key)
29+
? `process.env[${k}]=(process.env[${k}]||'')+${JSON.stringify(value)}`
30+
: `process.env[${k}]=${JSON.stringify(value)}`;
2631
})
2732
.join(';') +
2833
'})()' +

0 commit comments

Comments
 (0)