Expand description
The host environment given to child processes: the minimal one for processes that do not inherit the whole environment (plugin processes, stdio MCP servers), and the computer’s own environment, without what an AppImage launcher added, for every process graphrt starts.
Lives in the core because both host crates that start such processes
(graphrt-plugin, graphrt-mcp) already depend on it and on nothing else
in common.
§AppImage
An application packaged as a Linux AppImage (e.g. the graphrt desktop app,
which embeds these crates) runs with the bundle’s folders in front of
LD_LIBRARY_PATH, PATH, PYTHONPATH, XDG_DATA_DIRS, … and with
PYTHONHOME, GTK_PATH, GIO_MODULE_DIR, … pointing into the bundle (the
AppImage’s AppRun and its GTK hook set them, without keeping the old
values). The application needs them; a program of the computer started with
them loads the bundle’s older libraries and fails, e.g. /usr/bin/env: …/libsystemd.so.0: version `LIBSYSTEMD_254' not found for a
#!/usr/bin/env node launcher on Ubuntu 26.04. So when the running binary
is inside $APPDIR, every entry inside $APPDIR is dropped for children: a
list variable keeps its other entries, a variable with nothing left is
removed, and the runtime’s APPIMAGE / ARGV0 / OWD are removed. Outside
an AppImage (and on macOS / Windows) nothing changes.
Enums§
- EnvFix
- One change that gives a child the computer’s own environment back.
Constants§
- DEFAULT_
PASS_ ENV - Host variables always passed to a child process that does not inherit the environment.
Functions§
- appimage_
env_ fixes - The fixes for an environment
varsof an application running from the AppImage mounted atappdir(see the module docs), sorted by name. - apply_
env_ fixes apply_host_envwith explicitfixes(tests, or an embedder that works them out itself).- apply_
host_ env - Gives a command that inherits the environment the computer’s own one: call
it before the command’s own
envcalls. A Tokio command passescommand.as_std_mut(). - host_
env_ fixes - The fixes for this process, worked out once from the environment at the first call (empty outside a Linux AppImage).
- host_
var nameas a child gets it: the process value withhost_env_fixesapplied.- host_
vars - The whole environment as a child gets it (for a command started after
env_clear()). - minimal_
env - The variables of
DEFAULT_PASS_ENVplusextrathat are set on the host, with their values, for a child started afterenv_clear(). - set_
child_ env - Sets up the environment of a child process the way plugin processes and
stdio MCP servers get it: the whole host environment when
inherit, else onlyDEFAULT_PASS_ENVpluspass_env; either way as the computer has it, without an AppImage’s entries (host_env_fixes). Call it before the command’s ownenvcalls. A Tokio command passescommand.as_std_mut(). - set_
child_ env_ with set_child_envwith explicitfixesinstead of this process’s ones (tests, or an embedder that works them out itself).