diff --git a/src/client/common/variables/environment.ts b/src/client/common/variables/environment.ts index bce6d2ca17e9..2672eb535ca3 100644 --- a/src/client/common/variables/environment.ts +++ b/src/client/common/variables/environment.ts @@ -114,7 +114,7 @@ function parseEnvLine(line: string): [string, string] { // https://github.com/motdotla/dotenv/blob/master/lib/main.js#L32 // We don't use dotenv here because it loses ordering, which is // significant for substitution. - const match = line.match(/^\s*([a-zA-Z]\w*)\s*=\s*(.*?)?\s*$/); + const match = line.match(/^\s*(_*[a-zA-Z]\w*)\s*=\s*(.*?)?\s*$/); if (!match) { return ['', '']; } diff --git a/src/test/common/variables/envVarsService.unit.test.ts b/src/test/common/variables/envVarsService.unit.test.ts index aeedfdb94c00..590803ea135e 100644 --- a/src/test/common/variables/envVarsService.unit.test.ts +++ b/src/test/common/variables/envVarsService.unit.test.ts @@ -395,7 +395,6 @@ Path=/usr/x:/usr/y SPAM=1234 ham=5678 Eggs=9012 -_bogus1=... 1bogus2=... bogus 3=... bogus.4=... @@ -403,15 +402,17 @@ bogus-5=... bogus~6=... VAR1=3456 VAR_2=7890 +_VAR_3=1234 `); expect(vars).to.not.equal(undefined, 'Variables is undefiend'); - expect(Object.keys(vars!)).lengthOf(5, 'Incorrect number of variables'); + expect(Object.keys(vars!)).lengthOf(6, 'Incorrect number of variables'); expect(vars).to.have.property('SPAM', '1234', 'value is invalid'); expect(vars).to.have.property('ham', '5678', 'value is invalid'); expect(vars).to.have.property('Eggs', '9012', 'value is invalid'); expect(vars).to.have.property('VAR1', '3456', 'value is invalid'); expect(vars).to.have.property('VAR_2', '7890', 'value is invalid'); + expect(vars).to.have.property('_VAR_3', '1234', 'value is invalid'); }); test('Empty values become empty string', () => {