Skip to content

Commit 4ffa462

Browse files
authored
Merge pull request #6886 from dibarbet/fix_env
Fix specifying environment variables
2 parents 0e9fa04 + 1d2a1e2 commit 4ffa462

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/lsptoolshost/dotnetRuntimeExtensionResolver.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
5050
return {
5151
version: '' /* We don't need to know the version - we've already verified its high enough */,
5252
path: dotnetPath,
53-
env: process.env,
53+
env: this.getEnvironmentVariables(dotnetPath),
5454
};
5555
}
5656
}
@@ -67,6 +67,14 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
6767
throw new Error(`Cannot find dotnet path '${dotnetExecutablePath}'`);
6868
}
6969

70+
return {
71+
version: '' /* We don't need to know the version - we've already downloaded the correct one */,
72+
path: dotnetExecutablePath,
73+
env: this.getEnvironmentVariables(dotnetExecutablePath),
74+
};
75+
}
76+
77+
private getEnvironmentVariables(dotnetExecutablePath: string): NodeJS.ProcessEnv {
7078
// Take care to always run .NET processes on the runtime that we intend.
7179
// The dotnet.exe we point to should not go looking for other runtimes.
7280
const env: NodeJS.ProcessEnv = { ...process.env };
@@ -86,11 +94,7 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
8694
env.DOTNET_DbgMiniDumpName = path.join(languageServerOptions.crashDumpPath, '%e.%p.dmp');
8795
}
8896

89-
return {
90-
version: '' /* We don't need to know the version - we've already downloaded the correct one */,
91-
path: dotnetExecutablePath,
92-
env: process.env,
93-
};
97+
return env;
9498
}
9599

96100
/**

0 commit comments

Comments
 (0)