fallbackDirs (electron/shell-path.js)

omniwork · electron/shell-path.js · javascript · MIT
auth, Auth / Identity

Utility that probes the user’s login shell to build a robust PATH for Electron apps, merging fallbacks.

// Source: https://github.com/VedSoni-dev/omniwork | License: MIT | Copyright 2026 OmniWork contributors
// Provided via justclaw.it.com; keep this notice with the code.
"use strict";
// macOS (and Linux .desktop) launchers do NOT give a GUI app the PATH you see in
// your terminal — an app opened from Finder/Dock inherits roughly
// `/usr/bin:/bin:/usr/sbin:/sbin`. That silently breaks everything we shell out
// to: `npx` for MCP servers, `node`, and any toolchain the agent's run_command
// needs (homebrew, nvm, pyenv, cargo, …).
//
// So on first use we ask the user's real login shell what its PATH is and merge
// that into process.env, once, for the lifetime of the process. Child processes
// spawned later (MCP servers, run_command) inherit the repaired value.
//
// No-op on Windows, an

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key