mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix windows shell not having all environment variables (#6402)
* Fix windows shell not having all environment variables Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix startup due to buildVersion dependency Signed-off-by: Sebastian Malton <sebastian@malton.name> * Call cleanup in computeShellEnvironment Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
4e02ccb1c7
commit
d96918c966
15 files changed
+367
-144
No files matched your search
@@ -5,11 +5,11 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../runnable-tokens/on-load-of-application-injection-token";
|
||||
import { shellEnv } from "../../utils/shell-env";
|
||||
import os from "os";
|
||||
import { unionPATHs } from "../../../common/utils/union-env-path";
|
||||
import isSnapPackageInjectable from "../../../common/vars/is-snap-package.injectable";
|
||||
import electronAppInjectable from "../../electron-app/electron-app.injectable";
|
||||
import computeShellEnvironmentInjectable from "../../utils/shell-env/compute-shell-environment.injectable";
|
||||
|
||||
const setupShellInjectable = getInjectable({
|
||||
id: "setup-shell",
|
||||
@@ -18,13 +18,24 @@ const setupShellInjectable = getInjectable({
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const isSnapPackage = di.inject(isSnapPackageInjectable);
|
||||
const electronApp = di.inject(electronAppInjectable);
|
||||
const computeShellEnvironment = di.inject(computeShellEnvironmentInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-shell",
|
||||
run: async () => {
|
||||
run: async (): Promise<void> => {
|
||||
logger.info("🐚 Syncing shell environment");
|
||||
|
||||
const env = await shellEnv(os.userInfo().shell);
|
||||
const result = await computeShellEnvironment(os.userInfo().shell);
|
||||
|
||||
if (!result.callWasSuccessful) {
|
||||
return void logger.error(`[SHELL-SYNC]: ${result.error}`);
|
||||
}
|
||||
|
||||
const env = result.response;
|
||||
|
||||
if (!env) {
|
||||
return void logger.debug("[SHELL-SYNC]: nothing to do, env not special in shells");
|
||||
}
|
||||
|
||||
if (!env.LANG) {
|
||||
// the LANG env var expects an underscore instead of electron's dash
|
||||
|
||||
Reference in new issue
Block a user