fix(desktop): strip AppImage ARGV0 before child shells (#2588)
AppImage exports ARGV0 into the process environment. zsh treats that as argv[0] for every external command, which broke Python venv detection in the integrated terminal and managed OpenCode sessions. Clear ARGV0 in Electron before login-shell probing, refuse to re-apply it from shell snapshots, and strip it from terminal PTY and managed OpenCode launch environments. Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
co-authored by
Serhii Dziupin
parent
2ba8ae8bd4
commit
be38fb8cf4
@@ -1374,11 +1374,16 @@ const loadShellEnv = () => {
|
||||
|
||||
// Merge the user's login-shell env (PATH, etc.) into this process before we
|
||||
import { pathLooksUserConfigured, mergePathValues } from '@openchamber/web/server/lib/opencode/path-utils.js';
|
||||
import { stripAppImageArgv0Leak } from '@openchamber/web/server/lib/inherited-env.js';
|
||||
|
||||
// import/start the server in-process. The server and its children (opencode
|
||||
// CLI, git, etc.) inherit process.env directly now — there is no sidecar
|
||||
// subprocess to hand a custom env to.
|
||||
const inheritUserShellEnv = () => {
|
||||
// Clear before probing/merging so login-shell snapshots and children never
|
||||
// inherit the AppImage path as argv[0] via zsh's ARGV0 parameter (#2588).
|
||||
stripAppImageArgv0Leak(process.env);
|
||||
|
||||
const shellEnv = loadShellEnv();
|
||||
if (!shellEnv) return;
|
||||
|
||||
@@ -1388,7 +1393,7 @@ const inheritUserShellEnv = () => {
|
||||
const currentPathLooksUserConfigured = pathLooksUserConfigured(currentPath, homeDir, delimiter);
|
||||
|
||||
for (const [key, value] of Object.entries(shellEnv)) {
|
||||
if (key === 'PATH') continue;
|
||||
if (key === 'PATH' || key === 'ARGV0') continue;
|
||||
if (typeof process.env[key] === 'undefined') {
|
||||
process.env[key] = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user