fix: pass process environ to Io backend, fixing AppDataDirUnavailable on Linux#98
Open
Revaycolizer wants to merge 1 commit intojustrach:mainfrom
Open
fix: pass process environ to Io backend, fixing AppDataDirUnavailable on Linux#98Revaycolizer wants to merge 1 commit intojustrach:mainfrom
Revaycolizer wants to merge 1 commit intojustrach:mainfrom
Conversation
runtime.init() was calling Threaded.init(gpa, .{}) without passing the
process environ. The default environ in InitOptions is .empty, so all
child processes spawned via std.process.run/spawn received zero
environment variables.
This caused 'mer dev', 'mer build', and 'mer update' to fail on Linux
with 'unable to resolve zig cache directory: AppDataDirUnavailable'
because the child zig process had no HOME variable.
Fix: accept environ as a parameter in runtime.init() and forward it to
the Io backend (Threaded or Evented). All callsites now pass
init.environ from the Init.Minimal entry point.
Fixes child process environment inheritance on all platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
mer dev,mer build, andmer updatefail on Linux with:Root Cause
runtime.init()callsstd.Io.Threaded.init(gpa, .{})without passing the processenviron. The defaultInitOptions.environis.empty, so child processes get zero environment variables. Zig needsHOMEto resolve its cache directory.Fix
Accept
environas a parameter inruntime.init()and forward it to the Io backend. All callsites now passinit.environfromInit.Minimal.Files changed (6 files):
src/runtime.zigandsrc/runtime_threaded.zig- accept environ paramcli.zig,src/main.zig,examples/ui-showcase/src/main.zig- passinit.environtools/codegen.zig- pass.empty(no child spawning needed)