Skip to content

Commit 083ff3b

Browse files
committed
Fix environment names array parsing logic
Also, unset the environment variables entirely rather than setting them to an empty string.
1 parent 2491c18 commit 083ff3b

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

lib/tracer-config.js

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tracer-config.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tracer-config.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,19 @@ export async function getCombinedTracerConfig(
129129
return mainTracerConfig;
130130
}
131131

132+
133+
/**
134+
* Unsets environment variables needed for tracing for the current process.
135+
* This method is called to prevent the environment variables from interfering with
136+
* other system calls in this process.
137+
*/
132138
export function unsetTracerEnvVarsForCurrentProcess(): void {
133-
const tracerEnvVarNames: object = JSON.parse(
139+
const tracerEnvVarNames: string[] = JSON.parse(
134140
process.env["CODEQL_ACTION_TRACER_ENV_VAR_NAMES"] ?? "null",
135141
);
136142
if (tracerEnvVarNames !== null) {
137-
for (const envVar of Object.keys(tracerEnvVarNames)) {
138-
process.env[envVar] = "";
143+
for (const envVar of tracerEnvVarNames) {
144+
delete process.env[envVar];
139145
}
140146
}
141147
}

0 commit comments

Comments
 (0)