refactor(desktop): use electron-log in shell-env and simplify env merging (#26284)
This commit is contained in:
parent
30868f52ea
commit
dd8bb44d1d
3 changed files with 20 additions and 17 deletions
|
|
@ -3,7 +3,7 @@ import { fileURLToPath } from "node:url"
|
|||
import { app, utilityProcess } from "electron"
|
||||
import type { Details } from "electron"
|
||||
import { DEFAULT_SERVER_URL_KEY, WSL_ENABLED_KEY } from "./constants"
|
||||
import { getUserShell, loadShellEnv, mergeShellEnv } from "./shell-env"
|
||||
import { getUserShell, loadShellEnv } from "./shell-env"
|
||||
import { getStore } from "./store"
|
||||
import type { SqliteMigrationProgress } from "../preload/types"
|
||||
|
||||
|
|
@ -57,16 +57,13 @@ export function setWslConfig(config: WslConfig) {
|
|||
|
||||
export function preferAppEnv(userDataPath: string) {
|
||||
const shell = process.platform === "win32" ? null : getUserShell()
|
||||
Object.assign(
|
||||
process.env,
|
||||
mergeShellEnv(shell ? loadShellEnv(shell) : null, {
|
||||
...process.env,
|
||||
OPENCODE_EXPERIMENTAL_ICON_DISCOVERY: "true",
|
||||
OPENCODE_EXPERIMENTAL_FILEWATCHER: "true",
|
||||
OPENCODE_CLIENT: "desktop",
|
||||
XDG_STATE_HOME: process.env.XDG_STATE_HOME ?? userDataPath,
|
||||
}),
|
||||
)
|
||||
Object.assign(process.env, {
|
||||
...(shell ? loadShellEnv(shell) : null),
|
||||
OPENCODE_EXPERIMENTAL_ICON_DISCOVERY: "true",
|
||||
OPENCODE_EXPERIMENTAL_FILEWATCHER: "true",
|
||||
OPENCODE_CLIENT: "desktop",
|
||||
XDG_STATE_HOME: process.env.XDG_STATE_HOME ?? userDataPath,
|
||||
})
|
||||
}
|
||||
|
||||
export async function spawnLocalServer(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue