Thanks for the help. Yup, it fixed the unbind issue. However, the env variable($PATH) in theia front-end terminal is still the same as the underlying shell. Any thoughts on this on how to make this work properly?
Ah, I didn’t notice you were talking about terminals. You’ll have to look here and here to see how to change that. The terminal server doesn’t use the EnvVariablesServer at all.
@msujew Thanks for all your help and continued support. I’ve created CustomEnvironmentUtils class to extend the EnvironmentUtils to modify the path.
CustomEnvironmentUtils.ts
export class CustomEnvironmentUtils extends EnvironmentUtils {
protected readonly ENV_PATH: string = 'PATH';
protected readonly JDK17_PATH: string = '/usr/lib64/jdk-17/bin:';
mergeProcessEnv(env: Record<string, string | null> = {}): Record<string, string> {
env = this.normalizeEnv(env);
// eslint-disable-next-line no-null/no-null
const mergedEnv: Record<string, string> = Object.create(null);
for (const [key, value] of Object.entries(this.normalizeEnv(process.env))) {
// Ignore keys from `process.env` that are overridden in `env`. Accept only non-empty strings.
if (!(key in env) && value) {
mergedEnv[key] = value;
}
}
for (const [key, value] of Object.entries(env)) {
// Accept only non-empty strings from the `env` object.
if (value) {
if (key === this.ENV_PATH) {
mergedEnv[key] = this.JDK17_PATH;
}
else {
mergedEnv[key] = value;
}
}
}
return mergedEnv;
}
}
However, this JDK17_PATH is not getting prepended to the path. It adds JDK17_PATH to the end of the path. How do I prepend JDK17_PATH to the env variable PATH?