Fix completely overriding PATH in shellSync (#5451)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-08-09 10:08:56 -04:00
1 parent 592600c1bb
commit 5c11d7f7fe
4 files changed
+56 -2

No files matched your search

+3 -1
View File
@@ -8,6 +8,7 @@ import os from "os";
import { app } from "electron";
import logger from "./logger";
import { isSnap } from "../common/vars";
import { unionPATHs } from "../common/utils/union-env-path";
/**
* shellSync loads what would have been the environment if this application was
@@ -25,7 +26,8 @@ export async function shellSync() {
}
if (!isSnap) {
process.env.PATH = env.PATH;
// Prefer the synced PATH over the initial one
process.env.PATH = unionPATHs(env.PATH ?? "", process.env.PATH ?? "");
}
// The spread operator allows joining of objects. The precedence is last to first.
+1 -1
View File
@@ -6,7 +6,7 @@
import shellEnvironment from "shell-env";
import logger from "../logger";
export type EnvironmentVariables = Record<string, string>;
export type EnvironmentVariables = Partial<Record<string, string>>;
let shellSyncFailed = false;